diff options
author | Volker Lendecke <vl@samba.org> | 2013-11-09 20:37:01 +0100 |
---|---|---|
committer | Ira Cooper <ira@samba.org> | 2013-11-11 21:04:08 +0100 |
commit | 43ac7e81ec58d9043728b0e12b31f2993ec726c0 (patch) | |
tree | 0a38d09643eaa6b7d8bad9d09c8b9dbf4e9c09fe /lib | |
parent | 1cae867f72b79995a02eed96265fe9f69ce945da (diff) | |
download | samba-43ac7e81ec58d9043728b0e12b31f2993ec726c0.tar.gz samba-43ac7e81ec58d9043728b0e12b31f2993ec726c0.tar.xz samba-43ac7e81ec58d9043728b0e12b31f2993ec726c0.zip |
iniparser: Fix CID 241908 Copy into fixed size buffer
strcpy is never a good idea....
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/iniparser/src/iniparser.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/iniparser/src/iniparser.c b/lib/iniparser/src/iniparser.c index 09340876d8c..db00c88e7ad 100644 --- 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, longkey, val); + dictionary_set(d, l, val); return ; } |