]> www.infradead.org Git - users/dwmw2/crm114-spamd.git/commitdiff
handle negative lengths to read until eof
authorJohannes Berg <johannes@sipsolutions.net>
Wed, 10 May 2006 11:31:56 +0000 (13:31 +0200)
committerJohannes Berg <johannes@johannes.(none)>
Wed, 10 May 2006 11:31:56 +0000 (13:31 +0200)
dspam-spamd.c

index 71161cf9064a50a72bfe4379a1639c3d3e66dbd9..4f3cb6f39774cd3cca3d80fd6ff15da30903784b 100644 (file)
@@ -83,9 +83,11 @@ int main() {
        /* now read the message */
        if (length > MAXSIZE)
                ERROR(EX_IOERR, "message too big");
+       if (length < 0)
+               length = MAXSIZE;
 
        message = malloc(length+1);
-       fread(message, 1, length, stdin);
+       length = fread(message, 1, length, stdin);
        fclose(stdin);
 
        if (pipe(dspam_in) || pipe(dspam_out) || pipe(dspam_err))