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
eab7cc95c4
commit
07ce2a90b3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=52483
@ -81,8 +81,9 @@ main(argc, argv)
|
|||||||
err(1, NULL);
|
err(1, NULL);
|
||||||
strcpy(masterpasswd, optarg);
|
strcpy(masterpasswd, optarg);
|
||||||
if (masterpasswd[strlen(masterpasswd) - 1] != '/')
|
if (masterpasswd[strlen(masterpasswd) - 1] != '/')
|
||||||
masterpasswd[strlen(masterpasswd)] = '/';
|
strcat(masterpasswd, "/" _MASTERPASSWD);
|
||||||
strcat(masterpasswd, _MASTERPASSWD);
|
else
|
||||||
|
strcat(masterpasswd, _MASTERPASSWD);
|
||||||
if ((mppath = strdup(optarg)) == NULL)
|
if ((mppath = strdup(optarg)) == NULL)
|
||||||
err(1, NULL);
|
err(1, NULL);
|
||||||
if (mppath[strlen(mppath) - 1] == '/')
|
if (mppath[strlen(mppath) - 1] == '/')
|
||||||
|
Loading…
Reference in New Issue
Block a user