Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libsa RFC783 says the ErrMsg sent with an ERROR pack...



details:   https://anonhg.NetBSD.org/src/rev/6bcdb03469ef
branches:  trunk
changeset: 750763:6bcdb03469ef
user:      drochner <drochner%NetBSD.org@localhost>
date:      Wed Jan 13 10:56:17 2010 +0000

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

diffstat:

 sys/lib/libsa/tftp.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 7283ec753b0d -r 6bcdb03469ef sys/lib/libsa/tftp.c
--- a/sys/lib/libsa/tftp.c      Wed Jan 13 10:12:32 2010 +0000
+++ b/sys/lib/libsa/tftp.c      Wed Jan 13 10:56:17 2010 +0000
@@ -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);
 }



Home | Main Index | Thread Index | Old Index