Do not rely on malloc() to zero-fill allocated memory, since it is
not documented as doing so. This fixes a potential segmentation violation. PR: 14465 Reported by: Tony Finch <fanf@demon.net>
This commit is contained in:
parent
a150a46af7
commit
0a11b67bf0
@ -81,8 +81,9 @@ main(argc, argv)
|
||||
err(1, NULL);
|
||||
strcpy(masterpasswd, optarg);
|
||||
if (masterpasswd[strlen(masterpasswd) - 1] != '/')
|
||||
masterpasswd[strlen(masterpasswd)] = '/';
|
||||
strcat(masterpasswd, _MASTERPASSWD);
|
||||
strcat(masterpasswd, "/" _MASTERPASSWD);
|
||||
else
|
||||
strcat(masterpasswd, _MASTERPASSWD);
|
||||
if ((mppath = strdup(optarg)) == NULL)
|
||||
err(1, NULL);
|
||||
if (mppath[strlen(mppath) - 1] == '/')
|
||||
|
Loading…
Reference in New Issue
Block a user