From: Tom Yu Date: Thu, 7 Jul 1994 00:36:33 +0000 (+0000) Subject: * an1buf.c: Harry saves vs. Unix again. Making sure that anything X-Git-Tag: krb5-1.0-beta4.2~155 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=795198787838a5f8500e965adfe917bd922eb544;p=krb5.git * an1buf.c: Harry saves vs. Unix again. Making sure that anything that can call calloc with a zero argument won't return ENOMEM if calloc retuns NULL in this case. This was prompted by breakage under linux. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3956 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/asn.1/ChangeLog b/src/lib/krb5/asn.1/ChangeLog index 1f956d214..a8d2e3cac 100644 --- a/src/lib/krb5/asn.1/ChangeLog +++ b/src/lib/krb5/asn.1/ChangeLog @@ -1,5 +1,10 @@ Wed Jul 6 13:21:35 1994 Mark Eichin (eichin@cygnus.com) + * an1buf.c: Harry saves vs. Unix again. Making sure that anything + that can call calloc with a zero argument won't return ENOMEM if + calloc retuns NULL in this case. This was prompted by breakage + under linux. + * asn1_encode.c (asn1_encode_generaltime): don't use strftime on the output of gmtime -- under Solaris, it mutates it! (seems to be doing a timezone offset.) Besides, sprintf is quite sufficient. diff --git a/src/lib/krb5/asn.1/asn1buf.c b/src/lib/krb5/asn.1/asn1buf.c index 0503373c2..cc8cf7115 100644 --- a/src/lib/krb5/asn.1/asn1buf.c +++ b/src/lib/krb5/asn.1/asn1buf.c @@ -174,7 +174,7 @@ asn1_error_code asn1buf_remove_octetstring(DECLARG(asn1buf *, buf), if(buf->next + len - 1 > buf->bound) return ASN1_OVERRUN; *s = (asn1_octet*)calloc(len,sizeof(asn1_octet)); - if(*s == NULL) return ENOMEM; + if((*s == NULL) && len) return ENOMEM; for(i=0; inext)[i]; buf->next += len; @@ -192,7 +192,7 @@ asn1_error_code asn1buf_remove_charstring(DECLARG(asn1buf *, buf), if(buf->next + len - 1 > buf->bound) return ASN1_OVERRUN; *s = (char*)calloc(len,sizeof(char)); - if(*s == NULL) return ENOMEM; + if((*s == NULL) && len) return ENOMEM; for(i=0; inext)[i]; buf->next += len;