projects
/
profile
/
ivi
/
syslinux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
765e685
)
refstr: handle NULL in refstr[n]dup()
author
H. Peter Anvin
<hpa@zytor.com>
Tue, 19 Feb 2008 23:33:15 +0000
(15:33 -0800)
committer
H. Peter Anvin
<hpa@zytor.com>
Wed, 20 Feb 2008 00:51:24 +0000
(16:51 -0800)
com32/menu/refstr.c
patch
|
blob
|
history
diff --git
a/com32/menu/refstr.c
b/com32/menu/refstr.c
index
413561c
..
8b4c718
100644
(file)
--- a/
com32/menu/refstr.c
+++ b/
com32/menu/refstr.c
@@
-25,6
+25,9
@@
const char *refstrndup(const char *str, size_t len)
{
char *r;
+ if (!str)
+ return NULL;
+
len = strnlen(str, len);
r = malloc(sizeof(unsigned int)+len+1);
*(unsigned int *)r = 1;
@@
-39,6
+42,9
@@
const char *refstrdup(const char *str)
char *r;
size_t len;
+ if (!str)
+ return NULL;
+
len = strlen(str);
r = malloc(sizeof(unsigned int)+len+1);
*(unsigned int *)r = 1;