[126] in Zephyr_Comments
"coding error" in zwrite
daemon@ATHENA.MIT.EDU (jik@ATHENA.MIT.EDU)
Sat Oct 29 21:01:10 1988
From: <jik@ATHENA.MIT.EDU>
Date: Sat, 29 Oct 88 21:00:50 EDT
To: zephyr-comments@ATHENA.MIT.EDU
The following code appears at two different points in zwrite.c:
if (message)
message = realloc(message,
(unsigned)(msgsize+strlen(bfr)));
else
message = malloc((unsigned)(msgsize+strlen(bfr)));
if (message)
message = realloc(message, (unsigned)(msgsize+nchars));
else
message = malloc((unsigned)(msgsize+nchars));
The first is when reading a text message from stdin, and the second is
when reading what could be a binary. The error is in the else clause
of each if statement. If message is not true, then it is not
necessary to malloc "msgsize+" anything, since msgsize must equal 0.
This will not affect the operation of zwrite, but it's still wrong :-)
jik