git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1cae867
)
iniparser: Fix CID 241908 Copy into fixed size buffer
author
Volker Lendecke
<vl@samba.org>
Sat, 9 Nov 2013 19:37:01 +0000
(20:37 +0100)
committer
Ira Cooper
<ira@samba.org>
Mon, 11 Nov 2013 20:04:08 +0000
(21:04 +0100)
strcpy is never a good idea....
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
lib/iniparser/src/iniparser.c
patch
|
blob
|
history
diff --git
a/lib/iniparser/src/iniparser.c
b/lib/iniparser/src/iniparser.c
index 09340876d8c85b45106bdffec3f9cc0d9973fcbf..db00c88e7adac51034da0115fe57cff7629753ba 100644
(file)
--- a/
lib/iniparser/src/iniparser.c
+++ b/
lib/iniparser/src/iniparser.c
@@
-38,16
+38,18
@@
static void iniparser_add_entry(
char * val)
{
char longkey[2*ASCIILINESZ+1];
+ char *l;
/* Make a key as section:keyword */
if (key!=NULL) {
- sprintf(longkey, "%s:%s", sec, key);
+ snprintf(longkey, sizeof(longkey), "%s:%s", sec, key);
+ l = longkey;
} else {
-
strcpy(longkey, sec)
;
+
l = sec
;
}
/* Add (key,val) to dictionary */
- dictionary_set(d, l
ongkey
, val);
+ dictionary_set(d, l, val);
return ;
}