krb5: Fix NULL deref on ENOMEM in fkt_add_entry(2)

This commit is contained in:
Nicolas Williams
2020-09-15 11:26:06 -05:00
parent f2f2cd18b6
commit b2b6599f87

View File

@@ -582,6 +582,10 @@ fkt_add_entry(krb5_context context,
return ret; return ret;
} }
sp = krb5_storage_stdio_from_fd(fd, "wb+"); sp = krb5_storage_stdio_from_fd(fd, "wb+");
if (sp == NULL) {
(void) close(fd);
return ret;
}
krb5_storage_set_eof_code(sp, KRB5_KT_END); krb5_storage_set_eof_code(sp, KRB5_KT_END);
ret = krb5_ret_int8(sp, &pvno); ret = krb5_ret_int8(sp, &pvno);
if(ret) { if(ret) {