diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2018-07-03 19:36:41 -0500 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2018-07-26 14:08:20 -0500 |
commit | 16cf145fd659a01c5db7f286e8c9a4700f736920 (patch) | |
tree | fbc8049d19041b7d8c4073108e23a5aeb7a11aa6 /net/net.c | |
parent | 3855cad62342c3268465bc760e2bd7e6d0ce7f31 (diff) |
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>
Diffstat (limited to 'net/net.c')
-rw-r--r-- | net/net.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1522,12 +1522,12 @@ void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, int sport, void copy_filename(char *dst, const char *src, int size) { - if (*src && (*src == '"')) { + if (src && *src && (*src == '"')) { ++src; --size; } - while ((--size > 0) && *src && (*src != '"')) + while ((--size > 0) && src && *src && (*src != '"')) *dst++ = *src++; *dst = '\0'; } |