From: Alex Dowad Date: Thu, 23 Apr 2015 11:43:22 +0000 (-0700) Subject: Bug 4231 pt1: fd_open() not correctly handling empty descriptions X-Git-Tag: SQUID_3_5_4~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5273f0a77fd7535349839f16cc3501c0bc4e827;p=thirdparty%2Fsquid.git Bug 4231 pt1: fd_open() not correctly handling empty descriptions --- diff --git a/src/fd.cc b/src/fd.cc index 9c00f1d337..db445ae387 100644 --- a/src/fd.cc +++ b/src/fd.cc @@ -241,8 +241,7 @@ fd_open(int fd, unsigned int type, const char *desc) fdUpdateBiggest(fd, 1); - if (desc) - xstrncpy(F->desc, desc, FD_DESC_SZ); + fd_note(fd, desc); ++Number_FD; } @@ -251,7 +250,10 @@ void fd_note(int fd, const char *s) { fde *F = &fd_table[fd]; - xstrncpy(F->desc, s, FD_DESC_SZ); + if (s) + xstrncpy(F->desc, s, FD_DESC_SZ); + else + *(F->desc) = 0; // ""-string } void