[4517] in Athena Bugs
zwrite
daemon@ATHENA.MIT.EDU (marc@ATHENA.MIT.EDU)
Tue Mar 13 18:20:13 1990
From: marc@ATHENA.MIT.EDU
To: bugs@ATHENA.MIT.EDU
Cc: bug-zephyr@ATHENA.MIT.EDU
Reply-To: marc@MIT.EDU
Date: Tue, 13 Mar 90 18:19:58 EST
All architectures:
1) zwrite was appending an extra \0 to the end of the last field.
According to the ZEPH0.2 protocol, the fields are null-separated, not
null-terminated.
2) zwrite was appending an extra \n to the end of the signature field.
I blew the sucker away :-)
I have already made the changes in the zephyr project directory.
Here's an rcsdiff/patch for the curious:
*** /tmp/,RCSt1000512 Tue Mar 13 18:17:34 1990
--- zwrite.c Tue Mar 13 18:15:41 1990
***************
*** 4,10 ****
* Created by: Robert French
*
* $Source: /afs/athena.mit.edu/astaff/project/zephyr/src/clients/zwrite/RCS/zwrite.c,v $
! * $Author: jtkohl $
*
* Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
--- 4,10 ----
* Created by: Robert French
*
* $Source: /afs/athena.mit.edu/astaff/project/zephyr/src/clients/zwrite/RCS/zwrite.c,v $
! * $Author: marc $
*
* Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
***************
*** 20,26 ****
#include <ctype.h>
#ifndef lint
! static char rcsid_zwrite_c[] = "$Id: zwrite.c,v 1.31 90/03/02 15:54:53 jtkohl Exp $";
#endif lint
#define DEFAULT_CLASS "MESSAGE"
--- 20,26 ----
#include <ctype.h>
#ifndef lint
! static char rcsid_zwrite_c[] = "$Id: zwrite.c,v 1.33 90/03/13 18:15:14 marc Exp $";
#endif lint
#define DEFAULT_CLASS "MESSAGE"
***************
*** 249,255 ****
message = malloc((unsigned)(strlen(signature)+2));
(void) strcpy(message, signature);
msgsize = strlen(message);
- message[msgsize++] = '\n';
message[msgsize++] = '\0';
} else {
message = malloc(1);
--- 249,254 ----
***************
*** 271,278 ****
}
}
message[msgsize] = '\n';
! message[msgsize+1] = '\0';
! msgsize += 2;
} else {
if (isatty(0)) {
for (;;) {
--- 270,276 ----
}
}
message[msgsize] = '\n';
! msgsize += 1;
} else {
if (isatty(0)) {
for (;;) {
***************
*** 286,292 ****
msgsize += strlen(bfr);
}
message = realloc(message, (unsigned)(msgsize+1));
- message[msgsize++] = '\0';
}
else { /* Use read so you can send binary messages... */
while (nchars = read(fileno(stdin), bfr, sizeof bfr)) {
--- 284,289 ----
***************
*** 300,306 ****
}
/* end of msg */
message = realloc(message, (unsigned)(msgsize+1));
- message[msgsize++] = '\0'; /* null-terminate */
}
}
--- 297,302 ----