]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Make sure the Opaque_Handle string is null-terminated.
authorGuy Harris <[email protected]>
Wed, 19 Oct 2016 01:33:12 +0000 (18:33 -0700)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 18 Jan 2017 08:16:40 +0000 (09:16 +0100)
...even if the file handle length is 0.

parsenfsfh.c

index 43efd87693b098c36bfdca43e82d380ebacabdc7..8f48e774d7668991a1326eaba05ff8cfbed96746 100644 (file)
@@ -424,6 +424,7 @@ Parse_fh(register const unsigned char *fh, u_int len, my_fsid *fsidp,
            /* Save the actual handle, so it can be display with -u */
            for (i = 0; i < len*4 && i*2 < sizeof(fsidp->Opaque_Handle) - 1; i++)
                (void)snprintf(&(fsidp->Opaque_Handle[i*2]), 3, "%.2X", fhp[i]);
+           fsidp->Opaque_Handle[i*2] = '\0';
 
            /* XXX for now, give "bogus" values to aid debugging */
            fsidp->fsid_code = 0;