mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
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
1 changed files with 2 additions and 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';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue