mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
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>
This commit is contained in:
parent
1cae867f72
commit
43ac7e81ec
@ -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 ;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user