Module Name:    src
Committed By:   drochner
Date:           Wed Jan 13 10:56:17 UTC 2010

Modified Files:
        src/sys/lib/libsa: tftp.c

Log Message:
RFC783 says the ErrMsg sent with an ERROR packet needs to be
NUL-terminated


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/lib/libsa/tftp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libsa/tftp.c
diff -u src/sys/lib/libsa/tftp.c:1.29 src/sys/lib/libsa/tftp.c:1.30
--- src/sys/lib/libsa/tftp.c:1.29	Sat Jan 17 14:00:36 2009
+++ src/sys/lib/libsa/tftp.c	Wed Jan 13 10:56:17 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: tftp.c,v 1.29 2009/01/17 14:00:36 tsutsui Exp $	 */
+/*	$NetBSD: tftp.c,v 1.30 2010/01/13 10:56:17 drochner Exp $	 */
 
 /*
  * Copyright (c) 1996
@@ -234,14 +234,15 @@
 	} wbuf;
 	char           *wtail;
 
+	wtail = (char *)&wbuf.t.th_data;
 	if (h->islastblock) {
 		wbuf.t.th_opcode = htons((u_short)ACK);
 		wbuf.t.th_block = htons((u_short)h->currblock);
 	} else {
 		wbuf.t.th_opcode = htons((u_short)ERROR);
 		wbuf.t.th_code = htons((u_short)ENOSPACE); /* ??? */
+		*wtail++ = '\0'; /* empty error string */
 	}
-	wtail = (char *)&wbuf.t.th_data;
 
 	(void)sendudp(h->iodesc, &wbuf.t, wtail - (char *)&wbuf.t);
 }

Reply via email to