(decrypt_*): handle the case where the plaintext is 0 bytes long,
realloc might then return NULL. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16787 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -3414,7 +3414,7 @@ decrypt_internal_derived(krb5_context context,
|
||||
l = len - et->confoundersize;
|
||||
memmove(p, p + et->confoundersize, l);
|
||||
result->data = realloc(p, l);
|
||||
if(result->data == NULL) {
|
||||
if(result->data == NULL && l != 0) {
|
||||
free(p);
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
@@ -3479,7 +3479,7 @@ decrypt_internal(krb5_context context,
|
||||
l = len - et->confoundersize - checksum_sz;
|
||||
memmove(p, p + et->confoundersize + checksum_sz, l);
|
||||
result->data = realloc(p, l);
|
||||
if(result->data == NULL) {
|
||||
if(result->data == NULL && l != 0) {
|
||||
free(p);
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
@@ -3523,7 +3523,7 @@ decrypt_internal_special(krb5_context context,
|
||||
|
||||
memmove (p, p + cksum_sz + et->confoundersize, sz);
|
||||
result->data = realloc(p, sz);
|
||||
if(result->data == NULL) {
|
||||
if(result->data == NULL && sz != 0) {
|
||||
free(p);
|
||||
krb5_set_error_string(context, "malloc: out of memory");
|
||||
return ENOMEM;
|
||||
|
Reference in New Issue
Block a user