From 031ec0f258f152c1e20905b381aa7f5974db1f3d Mon Sep 17 00:00:00 2001 From: "Robert S. French" Date: Tue, 17 May 1988 17:21:01 +0000 Subject: All sorts of changes for ver 0.2 --- lib/ZParseNot.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'lib/ZParseNot.c') diff --git a/lib/ZParseNot.c b/lib/ZParseNot.c index 96cb4e0..54d3060 100644 --- a/lib/ZParseNot.c +++ b/lib/ZParseNot.c @@ -38,7 +38,7 @@ Code_t ZParseNotice(buffer, len, notice) notice->z_version = ptr; if (strncmp(ptr, ZVERSIONHDR, strlen(ZVERSIONHDR))) - return (ZERR_VERS); +/* return (ZERR_VERS);*/ abort(); ptr += strlen(ZVERSIONHDR); maj = atoi(ptr); if (maj != ZVERSIONMAJOR) @@ -51,15 +51,16 @@ Code_t ZParseNotice(buffer, len, notice) numfields = ntohl(*temp); ptr += strlen(ptr)+1; - numfields -= 2; + /*XXX 3 */ + numfields -= 2; /* numfields, version, and checksum */ if (numfields < 0) - numfields = 0; + return (ZERR_BADPKT); if (numfields) { if (ZReadAscii(ptr, end-ptr, (unsigned char *)temp, sizeof(int)) == ZERR_BADFIELD) return (ZERR_BADPKT); - notice->z_kind = (ZNotice_Kind_t)ntohl((ZNotice_Kind_t)*temp); + notice->z_kind = (ZNotice_Kind_t)ntohl(*temp); numfields--; ptr += strlen(ptr)+1; } @@ -169,17 +170,14 @@ Code_t ZParseNotice(buffer, len, notice) else notice->z_default_format = ""; - if (numfields) { - if (ZReadAscii(ptr, end-ptr, (unsigned char *)temp, - sizeof(ZChecksum_t)) - == ZERR_BADFIELD) - return (ZERR_BADPKT); - notice->z_checksum = ntohl(*temp); - numfields--; - ptr += strlen(ptr)+1; - } - else - notice->z_checksum = 0; +/*XXX*/ + if (ZReadAscii(ptr, end-ptr, (unsigned char *)temp, + sizeof(ZChecksum_t)) + == ZERR_BADFIELD) + return (ZERR_BADPKT); + notice->z_checksum = ntohl(*temp); + numfields--; + ptr += strlen(ptr)+1; if (numfields) { notice->z_multinotice = ptr; @@ -191,6 +189,7 @@ Code_t ZParseNotice(buffer, len, notice) for (i=0;iz_other_fields[i] = ptr; + numfields--; ptr += strlen(ptr)+1; } notice->z_num_other_fields = i; @@ -198,6 +197,16 @@ Code_t ZParseNotice(buffer, len, notice) for (i=0;iz_checksum = ntohl(*temp); + numfields--; + ptr += strlen(ptr)+1; +#endif + notice->z_message = (caddr_t) ptr; notice->z_message_len = len-(ptr-buffer); -- cgit v1.2.3