From: Tom Yu Date: Sat, 3 Jan 1998 03:36:18 +0000 (+0000) Subject: * asn1buf.c (asn12krb5_buf): Check return value of X-Git-Tag: krb5-1.1-beta1~903 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ea2229eeccd23b2d8d44074e789a6223f93b17d7;p=krb5.git * asn1buf.c (asn12krb5_buf): Check return value of malloc. [krb5-libs/518] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10345 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/asn.1/ChangeLog b/src/lib/krb5/asn.1/ChangeLog index cfdbde382..f018642ac 100644 --- a/src/lib/krb5/asn.1/ChangeLog +++ b/src/lib/krb5/asn.1/ChangeLog @@ -1,3 +1,8 @@ +Fri Jan 2 21:18:30 1998 Tom Yu + + * asn1buf.c (asn12krb5_buf): Check return value of + malloc. [krb5-libs/518] + Tue Sep 30 19:03:34 1997 Tom Yu * krbasn1.h: Replace HAS_STDLIB_H with something more sane. diff --git a/src/lib/krb5/asn.1/asn1buf.c b/src/lib/krb5/asn.1/asn1buf.c index 94b4ac418..c7226a11d 100644 --- a/src/lib/krb5/asn.1/asn1buf.c +++ b/src/lib/krb5/asn.1/asn1buf.c @@ -235,6 +235,10 @@ asn1_error_code asn12krb5_buf(buf, code) (*code)->length = 0; (*code)->length = asn1buf_len(buf); (*code)->data = (char*)malloc((((*code)->length)+1)*sizeof(char)); + if ((*code)->data == NULL) { + free(*code); + return ENOMEM; + } for(i=0; i < (*code)->length; i++) ((*code)->data)[i] = (buf->base)[((*code)->length)-i-1]; ((*code)->data)[(*code)->length] = '\0';