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>
This commit is contained in:
parent
3855cad623
commit
16cf145fd6
@ -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';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user