(decrypt_internal_derived): move up padsize to avoid memory leak
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13178 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		| @@ -3018,6 +3018,11 @@ decrypt_internal_derived(krb5_context context, | |||||||
| 	return EINVAL;		/* XXX - better error code? */ | 	return EINVAL;		/* XXX - better error code? */ | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     if (((len - checksum_sz) % et->padsize) != 0) { | ||||||
|  | 	krb5_clear_error_string(context); | ||||||
|  | 	return KRB5_BAD_MSIZE; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     p = malloc(len); |     p = malloc(len); | ||||||
|     if(len != 0 && p == NULL) { |     if(len != 0 && p == NULL) { | ||||||
| 	krb5_set_error_string(context, "malloc: out of memory"); | 	krb5_set_error_string(context, "malloc: out of memory"); | ||||||
| @@ -3027,10 +3032,6 @@ decrypt_internal_derived(krb5_context context, | |||||||
|  |  | ||||||
|     len -= checksum_sz; |     len -= checksum_sz; | ||||||
|  |  | ||||||
|     if ((len % et->padsize) != 0) { |  | ||||||
| 	krb5_clear_error_string(context); |  | ||||||
| 	return KRB5_BAD_MSIZE; |  | ||||||
|     } |  | ||||||
|     ret = _get_derived_key(context, crypto, ENCRYPTION_USAGE(usage), &dkey); |     ret = _get_derived_key(context, crypto, ENCRYPTION_USAGE(usage), &dkey); | ||||||
|     if(ret) { |     if(ret) { | ||||||
| 	free(p); | 	free(p); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Love Hörnquist Åstrand
					Love Hörnquist Åstrand