home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sun4nl!tuegate.tue.nl!svin02!wzv!wietse
- From: wietse@wzv.win.tue.nl (Wietse Venema)
- Newsgroups: comp.os.minix
- Subject: newgpkt.c V1.6 fix for off-by-one error
- Message-ID: <3818@wzv.win.tue.nl>
- Date: 26 Aug 92 16:12:35 GMT
- Organization: Eindhoven University of Technology, The Netherlands
- Lines: 39
-
- I found an off-by-one error in the gwrmsg() routine, that caused the g
- protocol driver to send an extraneous packet in case of a message that
- "exactly fits". A "<" operator was used instead of a "<=" operator.
-
- The problem showed up with messages such as:
-
- S D.hackticS2528 D.hackticS2528 root - D.hackticS2528 0666 root
-
- The message, including terminating null byte, fits exactly in
- a 64-byte packet. However, the gwrmsg() routine would send two
- packets, the second one being filled with 64 null bytes.
-
- The extraneous packet would then be interpreted as the first data of
- the file to be transmitted, causing havoc with the unbatching of news
- batches.
-
- Wietse Venema
- Eindhoven University of Technology
- The Netherlands
-
- *** newgpkt.c- Mon Aug 24 23:26:20 1992
- --- newgpkt.c Tue Aug 25 18:30:07 1992
- ***************
- *** 293,299 ****
- len = strlen(message) + 1; /* total length including '\0' */
- while (TRUE) {
- if (gsendpkt(message, len, TRUE) < 0) return(FAILED);
- ! if (len < rpktsize) return(OK); /* end of string */
- message += rpktsize;
- len -= rpktsize;
- }
- --- 293,299 ----
- len = strlen(message) + 1; /* total length including '\0' */
- while (TRUE) {
- if (gsendpkt(message, len, TRUE) < 0) return(FAILED);
- ! if (len <= rpktsize) return(OK);/* end of string */
- message += rpktsize;
- len -= rpktsize;
- }
-