From: Alex Dowad Date: Tue, 21 Apr 2015 13:40:29 +0000 (-0700) Subject: Bug 4231 pt1: fd_open() not correctly handling empty descriptions X-Git-Tag: merge-candidate-3-v1~168 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=528feb29dfe4ec34c36907171cdcb2e3eca62c3c;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 31018c61ff..f4adf142f9 100644 --- a/src/fd.cc +++ b/src/fd.cc @@ -242,8 +242,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; } @@ -252,7 +251,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