diff options
| author | ho <> | 2003-04-05 11:05:08 +0000 |
|---|---|---|
| committer | ho <> | 2003-04-05 11:05:08 +0000 |
| commit | d0dbce9d2ce1f0022e91a9d6007272d786be2a60 (patch) | |
| tree | 611b2e41c70e7877a4c20ebad4375734738e89c3 /src/lib/libcrypto/asn1 | |
| parent | a1ab6f619cee593a4d98d863d10af25c6ecf94c4 (diff) | |
| download | openbsd-d0dbce9d2ce1f0022e91a9d6007272d786be2a60.tar.gz openbsd-d0dbce9d2ce1f0022e91a9d6007272d786be2a60.tar.bz2 openbsd-d0dbce9d2ce1f0022e91a9d6007272d786be2a60.zip | |
Trivial sprintf() -> snprintf() changes. ok deraadt@
Diffstat (limited to 'src/lib/libcrypto/asn1')
| -rw-r--r-- | src/lib/libcrypto/asn1/a_mbstr.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1_lib.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1_par.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/t_req.c | 9 |
4 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c index 5d981c6553..58b437bc84 100644 --- a/src/lib/libcrypto/asn1/a_mbstr.c +++ b/src/lib/libcrypto/asn1/a_mbstr.c | |||
| @@ -145,14 +145,14 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, | |||
| 145 | 145 | ||
| 146 | if((minsize > 0) && (nchar < minsize)) { | 146 | if((minsize > 0) && (nchar < minsize)) { |
| 147 | ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_SHORT); | 147 | ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_SHORT); |
| 148 | sprintf(strbuf, "%ld", minsize); | 148 | snprintf(strbuf, sizeof strbuf, "%ld", minsize); |
| 149 | ERR_add_error_data(2, "minsize=", strbuf); | 149 | ERR_add_error_data(2, "minsize=", strbuf); |
| 150 | return -1; | 150 | return -1; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | if((maxsize > 0) && (nchar > maxsize)) { | 153 | if((maxsize > 0) && (nchar > maxsize)) { |
| 154 | ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_LONG); | 154 | ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_LONG); |
| 155 | sprintf(strbuf, "%ld", maxsize); | 155 | snprintf(strbuf, sizeof strbuf, "%ld", maxsize); |
| 156 | ERR_add_error_data(2, "maxsize=", strbuf); | 156 | ERR_add_error_data(2, "maxsize=", strbuf); |
| 157 | return -1; | 157 | return -1; |
| 158 | } | 158 | } |
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index 0638870ab7..60f36bb958 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
| @@ -412,8 +412,8 @@ void asn1_add_error(unsigned char *address, int offset) | |||
| 412 | { | 412 | { |
| 413 | char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1]; | 413 | char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1]; |
| 414 | 414 | ||
| 415 | sprintf(buf1,"%lu",(unsigned long)address); | 415 | snprintf(buf1,sizeof buf1,"%lu",(unsigned long)address); |
| 416 | sprintf(buf2,"%d",offset); | 416 | snprintf(buf2,sizeof buf2,"%d",offset); |
| 417 | ERR_add_error_data(4,"address=",buf1," offset=",buf2); | 417 | ERR_add_error_data(4,"address=",buf1," offset=",buf2); |
| 418 | } | 418 | } |
| 419 | 419 | ||
diff --git a/src/lib/libcrypto/asn1/asn1_par.c b/src/lib/libcrypto/asn1/asn1_par.c index facfdd27fc..4223c9ae45 100644 --- a/src/lib/libcrypto/asn1/asn1_par.c +++ b/src/lib/libcrypto/asn1/asn1_par.c | |||
| @@ -88,11 +88,11 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, | |||
| 88 | 88 | ||
| 89 | p=str; | 89 | p=str; |
| 90 | if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) | 90 | if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) |
| 91 | sprintf(str,"priv [ %d ] ",tag); | 91 | snprintf(str,sizeof str,"priv [ %d ] ",tag); |
| 92 | else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC) | 92 | else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC) |
| 93 | sprintf(str,"cont [ %d ]",tag); | 93 | snprintf(str,sizeof str,"cont [ %d ]",tag); |
| 94 | else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION) | 94 | else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION) |
| 95 | sprintf(str,"appl [ %d ]",tag); | 95 | snprintf(str,sizeof str,"appl [ %d ]",tag); |
| 96 | else p = ASN1_tag2str(tag); | 96 | else p = ASN1_tag2str(tag); |
| 97 | 97 | ||
| 98 | if (p2 != NULL) | 98 | if (p2 != NULL) |
diff --git a/src/lib/libcrypto/asn1/t_req.c b/src/lib/libcrypto/asn1/t_req.c index 739f272ecf..eca97e00cb 100644 --- a/src/lib/libcrypto/asn1/t_req.c +++ b/src/lib/libcrypto/asn1/t_req.c | |||
| @@ -116,7 +116,8 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
| 116 | l=0; | 116 | l=0; |
| 117 | for (i=0; i<ri->version->length; i++) | 117 | for (i=0; i<ri->version->length; i++) |
| 118 | { l<<=8; l+=ri->version->data[i]; } | 118 | { l<<=8; l+=ri->version->data[i]; } |
| 119 | sprintf(str,"%8sVersion: %s%lu (%s0x%lx)\n","",neg,l,neg,l); | 119 | snprintf(str,sizeof str,"%8sVersion: %s%lu (%s0x%lx)\n","",neg, |
| 120 | l,neg,l); | ||
| 120 | if (BIO_puts(bp,str) <= 0) goto err; | 121 | if (BIO_puts(bp,str) <= 0) goto err; |
| 121 | } | 122 | } |
| 122 | if(!(cflag & X509_FLAG_NO_SUBJECT)) | 123 | if(!(cflag & X509_FLAG_NO_SUBJECT)) |
| @@ -168,13 +169,13 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
| 168 | if(!(cflag & X509_FLAG_NO_ATTRIBUTES)) | 169 | if(!(cflag & X509_FLAG_NO_ATTRIBUTES)) |
| 169 | { | 170 | { |
| 170 | /* may not be */ | 171 | /* may not be */ |
| 171 | sprintf(str,"%8sAttributes:\n",""); | 172 | snprintf(str,sizeof str,"%8sAttributes:\n",""); |
| 172 | if (BIO_puts(bp,str) <= 0) goto err; | 173 | if (BIO_puts(bp,str) <= 0) goto err; |
| 173 | 174 | ||
| 174 | sk=x->req_info->attributes; | 175 | sk=x->req_info->attributes; |
| 175 | if (sk_X509_ATTRIBUTE_num(sk) == 0) | 176 | if (sk_X509_ATTRIBUTE_num(sk) == 0) |
| 176 | { | 177 | { |
| 177 | sprintf(str,"%12sa0:00\n",""); | 178 | snprintf(str,sizeof str,"%12sa0:00\n",""); |
| 178 | if (BIO_puts(bp,str) <= 0) goto err; | 179 | if (BIO_puts(bp,str) <= 0) goto err; |
| 179 | } | 180 | } |
| 180 | else | 181 | else |
| @@ -190,7 +191,7 @@ int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflags, unsigned long | |||
| 190 | a=sk_X509_ATTRIBUTE_value(sk,i); | 191 | a=sk_X509_ATTRIBUTE_value(sk,i); |
| 191 | if(X509_REQ_extension_nid(OBJ_obj2nid(a->object))) | 192 | if(X509_REQ_extension_nid(OBJ_obj2nid(a->object))) |
| 192 | continue; | 193 | continue; |
| 193 | sprintf(str,"%12s",""); | 194 | snprintf(str,sizeof str,"%12s",""); |
| 194 | if (BIO_puts(bp,str) <= 0) goto err; | 195 | if (BIO_puts(bp,str) <= 0) goto err; |
| 195 | if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) | 196 | if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) |
| 196 | { | 197 | { |
