From: Johannes Berg Date: Wed, 10 May 2006 11:31:56 +0000 (+0200) Subject: handle negative lengths to read until eof X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=70f0fd0c55969daf2c35059ed6f34a076c244f67;p=users%2Fdwmw2%2Fcrm114-spamd.git handle negative lengths to read until eof --- diff --git a/dspam-spamd.c b/dspam-spamd.c index 71161cf..4f3cb6f 100644 --- a/dspam-spamd.c +++ b/dspam-spamd.c @@ -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))