Commit 16cf145fd659a01c5db7f286e8c9a4700f736920

Authored by Joe Hershberger
1 parent 3855cad623

net: Make copy_filename() accept NULL src

Rather than crashing, check the src ptr and set dst to empty string.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

... ... @@ -1522,12 +1522,12 @@
1522 1522  
1523 1523 void copy_filename(char *dst, const char *src, int size)
1524 1524 {
1525   - if (*src && (*src == '"')) {
  1525 + if (src && *src && (*src == '"')) {
1526 1526 ++src;
1527 1527 --size;
1528 1528 }
1529 1529  
1530   - while ((--size > 0) && *src && (*src != '"'))
  1530 + while ((--size > 0) && src && *src && (*src != '"'))
1531 1531 *dst++ = *src++;
1532 1532 *dst = '\0';
1533 1533 }