projects
/
oweals
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3855cad
)
net: Make copy_filename() accept NULL src
author
Joe Hershberger
<joe.hershberger@ni.com>
Wed, 4 Jul 2018 00:36:41 +0000
(19:36 -0500)
committer
Joe Hershberger
<joe.hershberger@ni.com>
Thu, 26 Jul 2018 19:08:20 +0000
(14:08 -0500)
Rather than crashing, check the src ptr and set dst to empty string.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
net/net.c
patch
|
blob
|
history
diff --git
a/net/net.c
b/net/net.c
index 42a50e60f84e1c9805525b37b1ee6bbcfedc5293..333102ea79ee39bcd86cf2937e080a30efb4549d 100644
(file)
--- 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';
}