From: Joe Hershberger Date: Wed, 4 Jul 2018 00:36:41 +0000 (-0500) Subject: net: Make copy_filename() accept NULL src X-Git-Tag: v2018.09-rc1~26^2~16 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=16cf145fd659a01c5db7f286e8c9a4700f736920;p=oweals%2Fu-boot.git 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 --- diff --git a/net/net.c b/net/net.c index 42a50e60f8..333102ea79 100644 --- a/net/net.c +++ b/net/net.c @@ -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'; }