/* special case to let us enter encrypted passwords */
if (*str == ':')
{
- result = (chkpass *) palloc(sizeof(chkpass));
+ result = (chkpass *) palloc0(sizeof(chkpass));
strlcpy(result->password, str + 1, 13 + 1);
PG_RETURN_POINTER(result);
}
(errcode(ERRCODE_DATA_EXCEPTION),
errmsg("password \"%s\" is weak", str)));
- result = (chkpass *) palloc(sizeof(chkpass));
+ result = (chkpass *) palloc0(sizeof(chkpass));
mysalt[0] = salt_chars[random() & 0x3f];
mysalt[1] = salt_chars[random() & 0x3f];
result = (char *) palloc(16);
result[0] = ':';
- strcpy(result + 1, password->password);
+ strlcpy(result + 1, password->password, 15);
PG_RETURN_CSTRING(result);
}