[1232] in Athena Bugs

home help back first fref pref prev next nref lref last post

6.0C zwrite

daemon@ATHENA.MIT.EDU (jik@ATHENA.MIT.EDU)
Tue Oct 25 12:36:33 1988

From: <jik@ATHENA.MIT.EDU>
Date: Tue, 25 Oct 88 12:36:12 EDT
To: bugs@ATHENA.MIT.EDU
System type, version:	(VS2) Version 6.0C
System name:		oliver
What's wrong:

I sent the following bug report to zephyr-comments last night.  I just
realized I should probably have sent it to bugs as well.

I consider the second bug listed to be a major bug, because it causes
the "fields" command to put garbage text into the final field of a
message -- this has not exhibited itself before because all of the
zwgc capabilities which use fields are receiving messages from
automated zephyr clients (or from the server) which DO tack the null
onto the end of the message.

Since zwrite is on the srvd, would it be possible to get this fix into
the 6.0R release?  It shouldn't be that difficult, considering that
I've provided the context patch to fix the bug.

		      *************************

While playing around with trying to make the signature field to what
it's supposed to, I discovered two bugs in the sources to zwrite.

1. In the code which reads a message from stdin, if the message is
   empty after the first line is read, then the command
   malloc((unsigned)(msgsize+strlen(bfr))) is used to allocate space.
   The "msgsize+" is unnecessary, since the message has to be empty.
2. In the same message-reading code, the final null tacked onto the
   end of the code is NOT made part of the message, since msgsize is
   not incremented after adding the null.

A context diff is displayed below for installation into the sources.

***************
*** 213,224 ****
                        message = realloc(message,
                                          (unsigned)(msgsize+strlen(bfr)));
                else
!                       message = malloc((unsigned)(msgsize+strlen(bfr)));
                (void) strcpy(message+msgsize, bfr);
                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)) {
--- 213,225 ----
                        message = realloc(message,
                                          (unsigned)(msgsize+strlen(bfr)));
                else
!                       message = malloc((unsigned)(strlen(bfr)));
                (void) strcpy(message+msgsize, bfr);
                msgsize += strlen(bfr);
            }
            message = realloc(message, (unsigned)(msgsize+1));
            message[msgsize] = '\0';
+           msgsize += 1;
        }
        else {  /* Use read so you can send binary messages... */
            while (nchars = read(fileno(stdin), bfr, sizeof bfr)) {

                      *************************

  --> Jonathan Kamens
      Project Athena Watchmaker
      SIPB (Student Information Processing Board) Member
      Volunteer OLC Consultant
      jik@ATHENA.MIT.EDU

home help back first fref pref prev next nref lref last post