diff --git a/crypto/dist/openssl/apps/ca.c b/crypto/dist/openssl/apps/ca.c index 0618bb566086..bd48023f0c6a 100644 --- a/crypto/dist/openssl/apps/ca.c +++ b/crypto/dist/openssl/apps/ca.c @@ -451,9 +451,9 @@ bad: #else strncpy(buf[0],X509_get_default_cert_area(), sizeof(buf[0])-2-sizeof(CONFIG_FILE)); - strcat(buf[0],"/"); + strlcat(buf[0], "/", sizeof(buf[0])); #endif - strcat(buf[0],CONFIG_FILE); + strlcat(buf[0], CONFIG_FILE, sizeof(buf[0])); configfile=buf[0]; } @@ -951,9 +951,9 @@ bad: strncpy(buf[0],serialfile,BSIZE-4); #ifdef VMS - strcat(buf[0],"-new"); + strlcat(buf[0], "-new", sizeof(buf[0])); #else - strcat(buf[0],".new"); + strlcat(buf[0], ".new", sizeof(buf[0])); #endif if (!save_serial(buf[0],serial)) goto err; @@ -961,9 +961,9 @@ bad: strncpy(buf[1],dbfile,BSIZE-4); #ifdef VMS - strcat(buf[1],"-new"); + strlcat(buf[1], "-new", sizeof(buf[1])); #else - strcat(buf[1],".new"); + strlcat(buf[1], ".new", sizeof(buf[1])); #endif if (BIO_write_filename(out,buf[1]) <= 0) @@ -991,7 +991,7 @@ bad: strncpy(buf[2],outdir,BSIZE-(j*2)-6); #ifndef VMS - strcat(buf[2],"/"); + strlcat(buf[2], "/", sizeof(buf[2])); #endif n=(unsigned char *)&(buf[2][strlen(buf[2])]); @@ -999,7 +999,9 @@ bad: { for (k=0; kname); + snprintf(buf, sizeof(buf), "%s_default", v->name); if ((def=CONF_get_string(req_conf,dn_sect,buf)) == NULL) def=""; - sprintf(buf,"%s_value",v->name); + snprintf(buf, sizeof(buf), "%s_value", v->name); if ((value=CONF_get_string(req_conf,dn_sect,buf)) == NULL) value=NULL; - sprintf(buf,"%s_min",v->name); + snprintf(buf, sizeof(buf), "%s_min", v->name); min=(int)CONF_get_number(req_conf,dn_sect,buf); - sprintf(buf,"%s_max",v->name); + snprintf(buf, sizeof(buf), "%s_max", v->name); max=(int)CONF_get_number(req_conf,dn_sect,buf); if (!add_DN_object(subj,v->value,def,value,nid, @@ -1056,20 +1056,20 @@ start2: for (;;) if ((nid=OBJ_txt2nid(type)) == NID_undef) goto start2; - sprintf(buf,"%s_default",type); + snprintf(buf, sizeof(buf), "%s_default", type); if ((def=CONF_get_string(req_conf,attr_sect,buf)) == NULL) def=""; - sprintf(buf,"%s_value",type); + snprintf(buf, sizeof(buf),"%s_value", type); if ((value=CONF_get_string(req_conf,attr_sect,buf)) == NULL) value=NULL; - sprintf(buf,"%s_min",type); + snprintf(buf, sizeof(buf), "%s_min", type); min=(int)CONF_get_number(req_conf,attr_sect,buf); - sprintf(buf,"%s_max",type); + snprintf(buf, sizeof(buf), "%s_max", type); max=(int)CONF_get_number(req_conf,attr_sect,buf); if (!add_attribute_object(req, diff --git a/crypto/dist/openssl/apps/s_time.c b/crypto/dist/openssl/apps/s_time.c index 6ef2a2cbb14b..7768455203f4 100644 --- a/crypto/dist/openssl/apps/s_time.c +++ b/crypto/dist/openssl/apps/s_time.c @@ -489,7 +489,8 @@ int MAIN(int argc, char **argv) if (s_www_path != NULL) { - sprintf(buf,"GET %s HTTP/1.0\r\n\r\n",s_www_path); + snprintf(buf, sizeof(buf), "GET %s HTTP/1.0\r\n\r\n", + s_www_path); SSL_write(scon,buf,strlen(buf)); while ((i=SSL_read(scon,buf,sizeof(buf))) > 0) bytes_read+=i; @@ -544,7 +545,8 @@ next: if (s_www_path != NULL) { - sprintf(buf,"GET %s HTTP/1.0\r\n\r\n",s_www_path); + snprintf(buf, sizeof(buf), "GET %s HTTP/1.0\r\n\r\n", + s_www_path); SSL_write(scon,buf,strlen(buf)); while (SSL_read(scon,buf,sizeof(buf)) > 0) ; @@ -582,7 +584,8 @@ next: if (s_www_path) { - sprintf(buf,"GET %s HTTP/1.0\r\n\r\n",s_www_path); + snprintf(buf, sizeof(buf), "GET %s HTTP/1.0\r\n\r\n", + s_www_path); SSL_write(scon,buf,strlen(buf)); while ((i=SSL_read(scon,buf,sizeof(buf))) > 0) bytes_read+=i; diff --git a/crypto/dist/openssl/crypto/asn1/a_gentm.c b/crypto/dist/openssl/crypto/asn1/a_gentm.c index b55f882b7638..67d2cd0c3f53 100644 --- a/crypto/dist/openssl/crypto/asn1/a_gentm.c +++ b/crypto/dist/openssl/crypto/asn1/a_gentm.c @@ -219,8 +219,8 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, s->data=(unsigned char *)p; } - sprintf(p,"%04d%02d%02d%02d%02d%02dZ",ts->tm_year + 1900, - ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); + snprintf(p, 20, "%04d%02d%02d%02d%02d%02dZ",ts->tm_year + 1900, + ts->tm_mon + 1, ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec); s->length=strlen(p); s->type=V_ASN1_GENERALIZEDTIME; #ifdef CHARSET_EBCDIC_not diff --git a/crypto/dist/openssl/crypto/asn1/a_mbstr.c b/crypto/dist/openssl/crypto/asn1/a_mbstr.c index 5d981c655387..e0a49f321641 100644 --- a/crypto/dist/openssl/crypto/asn1/a_mbstr.c +++ b/crypto/dist/openssl/crypto/asn1/a_mbstr.c @@ -145,14 +145,14 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, if((minsize > 0) && (nchar < minsize)) { ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_SHORT); - sprintf(strbuf, "%ld", minsize); + snprintf(strbuf, sizeof(strbuf), "%ld", minsize); ERR_add_error_data(2, "minsize=", strbuf); return -1; } if((maxsize > 0) && (nchar > maxsize)) { ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_LONG); - sprintf(strbuf, "%ld", maxsize); + snprintf(strbuf, sizeof(strbuf), "%ld", maxsize); ERR_add_error_data(2, "maxsize=", strbuf); return -1; } diff --git a/crypto/dist/openssl/crypto/asn1/a_utctm.c b/crypto/dist/openssl/crypto/asn1/a_utctm.c index dd5955ac9fdd..f27ce85cd018 100644 --- a/crypto/dist/openssl/crypto/asn1/a_utctm.c +++ b/crypto/dist/openssl/crypto/asn1/a_utctm.c @@ -256,8 +256,8 @@ ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) s->data=(unsigned char *)p; } - sprintf(p,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100, - ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); + snprintf(p, 20, "%02d%02d%02d%02d%02d%02dZ", ts->tm_year%100, + ts->tm_mon + 1, ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec); s->length=strlen(p); s->type=V_ASN1_UTCTIME; #ifdef CHARSET_EBCDIC_not diff --git a/crypto/dist/openssl/crypto/asn1/asn1_lib.c b/crypto/dist/openssl/crypto/asn1/asn1_lib.c index e4a56a926af7..52955f2ee5a6 100644 --- a/crypto/dist/openssl/crypto/asn1/asn1_lib.c +++ b/crypto/dist/openssl/crypto/asn1/asn1_lib.c @@ -412,8 +412,8 @@ void asn1_add_error(unsigned char *address, int offset) { char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1]; - sprintf(buf1,"%lu",(unsigned long)address); - sprintf(buf2,"%d",offset); + snprintf(buf1, sizeof(buf1), "%lu", (unsigned long)address); + snprintf(buf2, sizeof(buf2), "%d", offset); ERR_add_error_data(4,"address=",buf1," offset=",buf2); } diff --git a/crypto/dist/openssl/crypto/asn1/asn1_par.c b/crypto/dist/openssl/crypto/asn1/asn1_par.c index facfdd27fca0..77e33a6f259b 100644 --- a/crypto/dist/openssl/crypto/asn1/asn1_par.c +++ b/crypto/dist/openssl/crypto/asn1/asn1_par.c @@ -88,11 +88,11 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, p=str; if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) - sprintf(str,"priv [ %d ] ",tag); + snprintf(str, sizeof(str), "priv [ %d ] ", tag); else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC) - sprintf(str,"cont [ %d ]",tag); + snprintf(str, sizeof(str), "cont [ %d ]", tag); else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION) - sprintf(str,"appl [ %d ]",tag); + snprintf(str, sizeof(str), "appl [ %d ]", tag); else p = ASN1_tag2str(tag); if (p2 != NULL) diff --git a/crypto/dist/openssl/crypto/asn1/t_pkey.c b/crypto/dist/openssl/crypto/asn1/t_pkey.c index a97341dd8d43..18dffec6c3a8 100644 --- a/crypto/dist/openssl/crypto/asn1/t_pkey.c +++ b/crypto/dist/openssl/crypto/asn1/t_pkey.c @@ -143,9 +143,10 @@ int RSA_print(BIO *bp, RSA *x, int off) } if (x->d == NULL) - sprintf(str,"Modulus (%d bit):",BN_num_bits(x->n)); + snprintf(str, sizeof(str), "Modulus (%d bit):", + BN_num_bits(x->n)); else - strcpy(str,"modulus:"); + strlcpy(str,"modulus:", sizeof(str)); if (!print(bp,str,x->n,m,off)) goto err; s=(x->d == NULL)?"Exponent:":"publicExponent:"; if (!print(bp,s,x->e,m,off)) goto err; diff --git a/crypto/dist/openssl/crypto/asn1/t_req.c b/crypto/dist/openssl/crypto/asn1/t_req.c index ea1af092db3f..706540e91f16 100644 --- a/crypto/dist/openssl/crypto/asn1/t_req.c +++ b/crypto/dist/openssl/crypto/asn1/t_req.c @@ -95,26 +95,27 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) char str[128]; ri=x->req_info; - sprintf(str,"Certificate Request:\n"); + snprintf(str, sizeof(str), "Certificate Request:\n"); if (BIO_puts(bp,str) <= 0) goto err; - sprintf(str,"%4sData:\n",""); + snprintf(str, sizeof(str), "%4sData:\n",""); if (BIO_puts(bp,str) <= 0) goto err; neg=(ri->version->type == V_ASN1_NEG_INTEGER)?"-":""; l=0; for (i=0; iversion->length; i++) { l<<=8; l+=ri->version->data[i]; } - sprintf(str,"%8sVersion: %s%lu (%s0x%lx)\n","",neg,l,neg,l); + snprintf(str, sizeof(str), "%8sVersion: %s%lu (%s0x%lx)\n", "", neg, + l, neg, l); if (BIO_puts(bp,str) <= 0) goto err; - sprintf(str,"%8sSubject: ",""); + snprintf(str, sizeof(str), "%8sSubject: ", ""); if (BIO_puts(bp,str) <= 0) goto err; X509_NAME_print(bp,ri->subject,16); - sprintf(str,"\n%8sSubject Public Key Info:\n",""); + snprintf(str, sizeof(str), "\n%8sSubject Public Key Info:\n", ""); if (BIO_puts(bp,str) <= 0) goto err; i=OBJ_obj2nid(ri->pubkey->algor->algorithm); - sprintf(str,"%12sPublic Key Algorithm: %s\n","", - (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)); + snprintf(str, sizeof(str), "%12sPublic Key Algorithm: %s\n", "", + (i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i)); if (BIO_puts(bp,str) <= 0) goto err; pkey=X509_REQ_get_pubkey(x); @@ -141,7 +142,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) EVP_PKEY_free(pkey); /* may not be */ - sprintf(str,"%8sAttributes:\n",""); + snprintf(str, sizeof(str), "%8sAttributes:\n", ""); if (BIO_puts(bp,str) <= 0) goto err; sk=x->req_info->attributes; @@ -149,7 +150,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) { if (!x->req_info->req_kludge) { - sprintf(str,"%12sa0:00\n",""); + snprintf(str, sizeof(str), "%12sa0:00\n", ""); if (BIO_puts(bp,str) <= 0) goto err; } } @@ -166,7 +167,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) a=sk_X509_ATTRIBUTE_value(sk,i); if(X509_REQ_extension_nid(OBJ_obj2nid(a->object))) continue; - sprintf(str,"%12s",""); + snprintf(str, sizeof(str), "%12s", ""); if (BIO_puts(bp,str) <= 0) goto err; if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0) { @@ -230,8 +231,8 @@ get_next: } i=OBJ_obj2nid(x->sig_alg->algorithm); - sprintf(str,"%4sSignature Algorithm: %s","", - (i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)); + snprintf(str, sizeof(str), "%4sSignature Algorithm: %s", "", + (i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i)); if (BIO_puts(bp,str) <= 0) goto err; n=x->signature->length; @@ -240,10 +241,11 @@ get_next: { if ((i%18) == 0) { - sprintf(str,"\n%8s",""); + snprintf(str, sizeof(str), "\n%8s", ""); if (BIO_puts(bp,str) <= 0) goto err; } - sprintf(str,"%02x%s",(unsigned char)s[i],((i+1) == n)?"":":"); + snprintf(str, sizeof(str), "%02x%s", (unsigned char)s[i], + ((i + 1) == n) ? "" : ":"); if (BIO_puts(bp,str) <= 0) goto err; } if (BIO_puts(bp,"\n") <= 0) goto err; diff --git a/crypto/dist/openssl/crypto/bio/b_dump.c b/crypto/dist/openssl/crypto/bio/b_dump.c index 8397cfab6a2c..b468c5c1622b 100644 --- a/crypto/dist/openssl/crypto/bio/b_dump.c +++ b/crypto/dist/openssl/crypto/bio/b_dump.c @@ -104,38 +104,40 @@ int BIO_dump_indent(BIO *bio, const char *s, int len, int indent) for(i=0;i=len) { - strcat(buf," "); + strlcat(buf, " ", sizeof(buf)); } else { ch=((unsigned char)*(s+i*dump_width+j)) & 0xff; - sprintf(tmp,"%02x%c",ch,j==7?'-':' '); - strcat(buf,tmp); + snprintf(tmp, sizeof(tmp), "%02x%c", ch, + j == 7 ? '-' : ' '); + strlcat(buf, tmp, sizeof(buf)); } } - strcat(buf," "); + strlcat(buf, " ", sizeof(buf)); for(j=0;j=len) break; ch=((unsigned char)*(s+i*dump_width+j)) & 0xff; #ifndef CHARSET_EBCDIC - sprintf(tmp,"%c",((ch>=' ')&&(ch<='~'))?ch:'.'); + snprintf(tmp, sizeof(tmp), "%c", + ((ch >= ' ') && (ch <= '~')) ? ch : '.'); #else - sprintf(tmp,"%c",((ch>=os_toascii[' '])&&(ch<=os_toascii['~'])) - ? os_toebcdic[ch] - : '.'); + snprintf(tmp, sizeof(tmp), "%c", + ((ch >= os_toascii[' ']) && (ch <= os_toascii['~'])) + ? os_toebcdic[ch] : '.'); #endif - strcat(buf,tmp); + strlcat(buf, tmp, sizeof(buf)); } - strcat(buf,"\n"); + strlcat(buf, "\n", sizeof(buf)); /* if this is the last call then update the ddt_dump thing so that * we will move the selection point in the debug window */ @@ -144,7 +146,8 @@ int BIO_dump_indent(BIO *bio, const char *s, int len, int indent) #ifdef TRUNCATE if (trunc > 0) { - sprintf(buf,"%s%04x - \n",str,len+trunc); + snprintf(buf, sizeof(buf), "%s%04x - \n", str, + len + trunc); ret+=BIO_write(bio,(char *)buf,strlen(buf)); } #endif diff --git a/crypto/dist/openssl/crypto/bio/bio_cb.c b/crypto/dist/openssl/crypto/bio/bio_cb.c index 37c7c2266683..26b87ec22b6b 100644 --- a/crypto/dist/openssl/crypto/bio/bio_cb.c +++ b/crypto/dist/openssl/crypto/bio/bio_cb.c @@ -74,51 +74,64 @@ long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp, if (BIO_CB_RETURN & cmd) r=ret; - sprintf(buf,"BIO[%08lX]:",(unsigned long)bio); + snprintf(buf, sizeof(buf), "BIO[%08lX]:", (unsigned long)bio); p= &(buf[14]); switch (cmd) { case BIO_CB_FREE: - sprintf(p,"Free - %s\n",bio->method->name); + snprintf(p, sizeof(buf) - (p - buf), "Free - %s\n", + bio->method->name); break; case BIO_CB_READ: if (bio->method->type & BIO_TYPE_DESCRIPTOR) - sprintf(p,"read(%d,%d) - %s fd=%d\n",bio->num,argi,bio->method->name,bio->num); + snprintf(p, sizeof(buf) - (p - buf), + "read(%d,%d) - %s fd=%d\n", bio->num, argi, + bio->method->name,bio->num); else - sprintf(p,"read(%d,%d) - %s\n",bio->num,argi,bio->method->name); + snprintf(p, sizeof(buf) - (p - buf), + "read(%d,%d) - %s\n", bio->num, argi, + bio->method->name); break; case BIO_CB_WRITE: if (bio->method->type & BIO_TYPE_DESCRIPTOR) - sprintf(p,"write(%d,%d) - %s fd=%d\n",bio->num,argi,bio->method->name,bio->num); + snprintf(p, sizeof(buf) - (p - buf), + "write(%d,%d) - %s fd=%d\n", bio->num, argi, + bio->method->name,bio->num); else - sprintf(p,"write(%d,%d) - %s\n",bio->num,argi,bio->method->name); + snprintf(p, sizeof(buf) - (p - buf), + "write(%d,%d) - %s\n", bio->num, argi, + bio->method->name); break; case BIO_CB_PUTS: - sprintf(p,"puts() - %s\n",bio->method->name); + snprintf(p, sizeof(buf) - (p - buf), "puts() - %s\n", + bio->method->name); break; case BIO_CB_GETS: - sprintf(p,"gets(%d) - %s\n",argi,bio->method->name); + snprintf(p, sizeof(buf) - (p - buf), "gets(%d) - %s\n", + argi, bio->method->name); break; case BIO_CB_CTRL: - sprintf(p,"ctrl(%d) - %s\n",argi,bio->method->name); + snprintf(p, sizeof(buf) - (p - buf), "ctrl(%d) - %s\n", + argi, bio->method->name); break; case BIO_CB_RETURN|BIO_CB_READ: - sprintf(p,"read return %ld\n",ret); + snprintf(p, sizeof(buf) - (p - buf), "read return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_WRITE: - sprintf(p,"write return %ld\n",ret); + snprintf(p, sizeof(buf) - (p - buf), "write return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_GETS: - sprintf(p,"gets return %ld\n",ret); + snprintf(p, sizeof(buf) - (p - buf), "gets return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_PUTS: - sprintf(p,"puts return %ld\n",ret); + snprintf(p, sizeof(buf) - (p - buf), "puts return %ld\n", ret); break; case BIO_CB_RETURN|BIO_CB_CTRL: - sprintf(p,"ctrl return %ld\n",ret); + snprintf(p, sizeof(buf) - (p - buf), "ctrl return %ld\n", ret); break; default: - sprintf(p,"bio callback - unknown type (%d)\n",cmd); + snprintf(p, sizeof(buf) - (p - buf), + "bio callback - unknown type (%d)\n", cmd); break; } diff --git a/crypto/dist/openssl/crypto/bio/bss_conn.c b/crypto/dist/openssl/crypto/bio/bss_conn.c index a6b77a2cb9b9..a6cd25261881 100644 --- a/crypto/dist/openssl/crypto/bio/bss_conn.c +++ b/crypto/dist/openssl/crypto/bio/bss_conn.c @@ -521,8 +521,8 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) char buf[16]; char *p = ptr; - sprintf(buf,"%d.%d.%d.%d", - p[0],p[1],p[2],p[3]); + snprintf(buf, sizeof(buf), "%d.%d.%d.%d", + p[0], p[1], p[2], p[3]); if (data->param_hostname != NULL) OPENSSL_free(data->param_hostname); data->param_hostname=BUF_strdup(buf); @@ -532,7 +532,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) { char buf[16]; - sprintf(buf,"%d",*(int *)ptr); + snprintf(buf, sizeof(buf), "%d", *(int *)ptr); if (data->param_port != NULL) OPENSSL_free(data->param_port); data->param_port=BUF_strdup(buf); diff --git a/crypto/dist/openssl/crypto/bio/bss_file.c b/crypto/dist/openssl/crypto/bio/bss_file.c index 1f770b390f8f..128633708d9d 100644 --- a/crypto/dist/openssl/crypto/bio/bss_file.c +++ b/crypto/dist/openssl/crypto/bio/bss_file.c @@ -218,15 +218,15 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) if (num & BIO_FP_APPEND) { if (num & BIO_FP_READ) - strcpy(p,"a+"); - else strcpy(p,"a"); + strlcpy(p, "a+", sizeof(p)); + else strlcpy(p, "a", sizeof(p)); } else if ((num & BIO_FP_READ) && (num & BIO_FP_WRITE)) - strcpy(p,"r+"); + strlcpy(p, "r+", sizeof(p)); else if (num & BIO_FP_WRITE) - strcpy(p,"w"); + strlcpy(p, "w", sizeof(p)); else if (num & BIO_FP_READ) - strcpy(p,"r"); + strlcpy(p, "r", sizeof(p)); else { BIOerr(BIO_F_FILE_CTRL,BIO_R_BAD_FOPEN_MODE); @@ -235,9 +235,9 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) } #if defined(MSDOS) || defined(WINDOWS) if (!(num & BIO_FP_TEXT)) - strcat(p,"b"); + strlcat(p, "b", sizeof(p)); else - strcat(p,"t"); + strlcat(p, "t", sizeof(p)); #endif fp=fopen(ptr,p); if (fp == NULL) diff --git a/crypto/dist/openssl/crypto/bio/bss_log.c b/crypto/dist/openssl/crypto/bio/bss_log.c index 06d37f6535e8..c70dca70c769 100644 --- a/crypto/dist/openssl/crypto/bio/bss_log.c +++ b/crypto/dist/openssl/crypto/bio/bss_log.c @@ -297,7 +297,7 @@ static void xsyslog(BIO *bp, int priority, const char *string) break; } - sprintf(pidbuf, "[%d] ", pid); + snprintf(pidbuf, sizeof(pidbuf), "[%d] ", pid); lpszStrings[0] = pidbuf; lpszStrings[1] = string; diff --git a/crypto/dist/openssl/crypto/bn/bn_lib.c b/crypto/dist/openssl/crypto/bn/bn_lib.c index 7767d6517022..22ac53842d37 100644 --- a/crypto/dist/openssl/crypto/bn/bn_lib.c +++ b/crypto/dist/openssl/crypto/bn/bn_lib.c @@ -145,11 +145,11 @@ char *BN_options(void) { init++; #ifdef BN_LLONG - sprintf(data,"bn(%d,%d)",(int)sizeof(BN_ULLONG)*8, - (int)sizeof(BN_ULONG)*8); + snprintf(data, sizeof(data), "bn(%d,%d)", + (int)sizeof(BN_ULLONG) * 8, (int)sizeof(BN_ULONG) * 8); #else - sprintf(data,"bn(%d,%d)",(int)sizeof(BN_ULONG)*8, - (int)sizeof(BN_ULONG)*8); + snprintf(data, sizeof(data), "bn(%d,%d)", + (int)sizeof(BN_ULONG) * 8, (int)sizeof(BN_ULONG) * 8); #endif } return(data); diff --git a/crypto/dist/openssl/crypto/bn/bn_print.c b/crypto/dist/openssl/crypto/bn/bn_print.c index 532e66bcc397..5a5b3b176991 100644 --- a/crypto/dist/openssl/crypto/bn/bn_print.c +++ b/crypto/dist/openssl/crypto/bn/bn_print.c @@ -139,12 +139,12 @@ char *BN_bn2dec(const BIGNUM *a) /* We now have a series of blocks, BN_DEC_NUM chars * in length, where the last one needs truncation. * The blocks need to be reversed in order. */ - sprintf(p,BN_DEC_FMT1,*lp); + snprintf(p, sizeof(buf) - (p - buf), BN_DEC_FMT1, *lp); while (*p) p++; while (lp != bn_data) { lp--; - sprintf(p,BN_DEC_FMT2,*lp); + snprintf(p, sizeof(buf) - (p - buf), BN_DEC_FMT2, *lp); while (*p) p++; } } diff --git a/crypto/dist/openssl/crypto/conf/conf_def.c b/crypto/dist/openssl/crypto/conf/conf_def.c index d43c9de3f5f0..482bd2e27e3a 100644 --- a/crypto/dist/openssl/crypto/conf/conf_def.c +++ b/crypto/dist/openssl/crypto/conf/conf_def.c @@ -206,7 +206,7 @@ static int def_load(CONF *conf, BIO *in, long *line) CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE); goto err; } - strcpy(section,"default"); + strlcpy(section, "default", 10); if (_CONF_new_data(conf) == 0) { @@ -354,7 +354,7 @@ again: goto err; } if (psection == NULL) psection=section; - v->name=(char *)OPENSSL_malloc(strlen(pname)+1); + v->name = BUF_strdup(pname); v->value=NULL; if (v->name == NULL) { @@ -362,7 +362,6 @@ again: ERR_R_MALLOC_FAILURE); goto err; } - strcpy(v->name,pname); if (!str_copy(conf,psection,&(v->value),start)) goto err; if (strcmp(psection,section) != 0) @@ -417,7 +416,7 @@ err: if (buff != NULL) BUF_MEM_free(buff); if (section != NULL) OPENSSL_free(section); if (line != NULL) *line=eline; - sprintf(btmp,"%ld",eline); + snprintf(btmp, sizeof(btmp), "%ld", eline); ERR_add_error_data(2,"line ",btmp); if ((h != conf->data) && (conf->data != NULL)) CONF_free(conf->data); if (v != NULL) diff --git a/crypto/dist/openssl/crypto/cversion.c b/crypto/dist/openssl/crypto/cversion.c index 297f8843f585..030665f85518 100644 --- a/crypto/dist/openssl/crypto/cversion.c +++ b/crypto/dist/openssl/crypto/cversion.c @@ -72,7 +72,7 @@ const char *SSLeay_version(int t) #ifdef DATE static char buf[sizeof(DATE)+11]; - sprintf(buf,"built on: %s",DATE); + snprintf(buf, sizeof(buf), "built on: %s", DATE); return(buf); #else return("built on: date not available"); @@ -83,7 +83,7 @@ const char *SSLeay_version(int t) #ifdef CFLAGS static char buf[sizeof(CFLAGS)+11]; - sprintf(buf,"compiler: %s",CFLAGS); + snprintf(buf, sizeof(buf), "compiler: %s", CFLAGS); return(buf); #else return("compiler: information not available"); @@ -94,7 +94,7 @@ const char *SSLeay_version(int t) #ifdef PLATFORM static char buf[sizeof(PLATFORM)+11]; - sprintf(buf,"platform: %s", PLATFORM); + snprintf(buf, sizeof(buf), "platform: %s", PLATFORM); return(buf); #else return("platform: information not available"); diff --git a/crypto/dist/openssl/crypto/des/ecb_enc.c b/crypto/dist/openssl/crypto/des/ecb_enc.c index d481327ef3b3..61a38bc91e35 100644 --- a/crypto/dist/openssl/crypto/des/ecb_enc.c +++ b/crypto/dist/openssl/crypto/des/ecb_enc.c @@ -96,7 +96,8 @@ const char *des_options(void) size="int"; else size="long"; - sprintf(buf,"des(%s,%s,%s,%s)",ptr,risc,unroll,size); + snprintf(buf, sizeof(buf), "des(%s,%s,%s,%s)", ptr, risc, + unroll, size); init=0; } return(buf); diff --git a/crypto/dist/openssl/crypto/dh/dhtest.c b/crypto/dist/openssl/crypto/dh/dhtest.c index a38465da130e..abafedd9d53f 100644 --- a/crypto/dist/openssl/crypto/dh/dhtest.c +++ b/crypto/dist/openssl/crypto/dh/dhtest.c @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) BIO_puts(out,"key1 ="); for (i=0; ialgorithm); + if (!a->algorithm) + strlcpy(obj_tmp, "NULL", sizeof(obj_tmp)); + else + i2t_ASN1_OBJECT(obj_tmp, 80, a->algorithm); ERR_add_error_data(2, "TYPE=", obj_tmp); EVP_PKEY_free (pkey); return NULL; diff --git a/crypto/dist/openssl/crypto/hmac/hmactest.c b/crypto/dist/openssl/crypto/hmac/hmactest.c index 4b56b8ee1355..5ff378483751 100644 --- a/crypto/dist/openssl/crypto/hmac/hmactest.c +++ b/crypto/dist/openssl/crypto/hmac/hmactest.c @@ -153,7 +153,7 @@ static char *pt(unsigned char *md) static char buf[80]; for (i=0; inum_items); + snprintf(buf, sizeof(buf), "num_items = %lu\n", + lh->num_items); BIO_puts(out,buf); - sprintf(buf,"num_nodes = %u\n",lh->num_nodes); + snprintf(buf, sizeof(buf), "num_nodes = %u\n", + lh->num_nodes); BIO_puts(out,buf); - sprintf(buf,"num_alloc_nodes = %u\n",lh->num_alloc_nodes); + snprintf(buf, sizeof(buf), "num_alloc_nodes = %u\n", + lh->num_alloc_nodes); BIO_puts(out,buf); - sprintf(buf,"num_expands = %lu\n",lh->num_expands); + snprintf(buf, sizeof(buf), "num_expands = %lu\n", + lh->num_expands); BIO_puts(out,buf); - sprintf(buf,"num_expand_reallocs = %lu\n",lh->num_expand_reallocs); + snprintf(buf, sizeof(buf), "num_expand_reallocs = %lu\n", + lh->num_expand_reallocs); BIO_puts(out,buf); - sprintf(buf,"num_contracts = %lu\n",lh->num_contracts); + snprintf(buf, sizeof(buf), "num_contracts = %lu\n", + lh->num_contracts); BIO_puts(out,buf); - sprintf(buf,"num_contract_reallocs = %lu\n",lh->num_contract_reallocs); + snprintf(buf, sizeof(buf), "num_contract_reallocs = %lu\n", + lh->num_contract_reallocs); BIO_puts(out,buf); - sprintf(buf,"num_hash_calls = %lu\n",lh->num_hash_calls); + snprintf(buf, sizeof(buf), "num_hash_calls = %lu\n", + lh->num_hash_calls); BIO_puts(out,buf); - sprintf(buf,"num_comp_calls = %lu\n",lh->num_comp_calls); + snprintf(buf, sizeof(buf), "num_comp_calls = %lu\n", + lh->num_comp_calls); BIO_puts(out,buf); - sprintf(buf,"num_insert = %lu\n",lh->num_insert); + snprintf(buf, sizeof(buf), "num_insert = %lu\n", + lh->num_insert); BIO_puts(out,buf); - sprintf(buf,"num_replace = %lu\n",lh->num_replace); + snprintf(buf, sizeof(buf), "num_replace = %lu\n", + lh->num_replace); BIO_puts(out,buf); - sprintf(buf,"num_delete = %lu\n",lh->num_delete); + snprintf(buf, sizeof(buf), "num_delete = %lu\n", + lh->num_delete); BIO_puts(out,buf); - sprintf(buf,"num_no_delete = %lu\n",lh->num_no_delete); + snprintf(buf, sizeof(buf), "num_no_delete = %lu\n", + lh->num_no_delete); BIO_puts(out,buf); - sprintf(buf,"num_retrieve = %lu\n",lh->num_retrieve); + snprintf(buf, sizeof(buf), "num_retrieve = %lu\n", + lh->num_retrieve); BIO_puts(out,buf); - sprintf(buf,"num_retrieve_miss = %lu\n",lh->num_retrieve_miss); + snprintf(buf, sizeof(buf), "num_retrieve_miss = %lu\n", + lh->num_retrieve_miss); BIO_puts(out,buf); - sprintf(buf,"num_hash_comps = %lu\n",lh->num_hash_comps); + snprintf(buf, sizeof(buf), "num_hash_comps = %lu\n", + lh->num_hash_comps); BIO_puts(out,buf); #ifdef DEBUG - sprintf(buf,"p = %u\n",lh->p); + snprintf(buf, sizeof(buf), "p = %u\n", lh->p); BIO_puts(out,buf); - sprintf(buf,"pmax = %u\n",lh->pmax); + snprintf(buf, sizeof(buf), "pmax = %u\n", lh->pmax); BIO_puts(out,buf); - sprintf(buf,"up_load = %lu\n",lh->up_load); + snprintf(buf, sizeof(buf), "up_load = %lu\n", + lh->up_load); BIO_puts(out,buf); - sprintf(buf,"down_load = %lu\n",lh->down_load); + snprintf(buf, sizeof(buf), "down_load = %lu\n", + lh->down_load); BIO_puts(out,buf); #endif } @@ -235,7 +253,7 @@ void lh_node_stats_bio(LHASH *lh, BIO *out) { for (n=lh->b[i],num=0; n != NULL; n=n->next) num++; - sprintf(buf,"node %6u -> %3u\n",i,num); + snprintf(buf, sizeof(buf), "node %6u -> %3u\n", i, num); BIO_puts(out,buf); } } @@ -258,16 +276,16 @@ void lh_node_usage_stats_bio(LHASH *lh, BIO *out) total+=num; } } - sprintf(buf,"%lu nodes used out of %u\n",n_used,lh->num_nodes); + snprintf(buf, sizeof(buf), "%lu nodes used out of %u\n", n_used, + lh->num_nodes); BIO_puts(out,buf); - sprintf(buf,"%lu items\n",total); + snprintf(buf, sizeof(buf), "%lu items\n", total); BIO_puts(out,buf); if (n_used == 0) return; - sprintf(buf,"load %d.%02d actual load %d.%02d\n", - (int)(total/lh->num_nodes), - (int)((total%lh->num_nodes)*100/lh->num_nodes), - (int)(total/n_used), - (int)((total%n_used)*100/n_used)); + snprintf(buf, sizeof(buf), "load %d.%02d actual load %d.%02d\n", + (int)(total/lh->num_nodes), + (int)((total%lh->num_nodes)*100/lh->num_nodes), + (int)(total/n_used), (int)((total%n_used)*100/n_used)); BIO_puts(out,buf); } diff --git a/crypto/dist/openssl/crypto/md2/md2test.c b/crypto/dist/openssl/crypto/md2/md2test.c index e3f4fb4c341a..988cd5121e00 100644 --- a/crypto/dist/openssl/crypto/md2/md2test.c +++ b/crypto/dist/openssl/crypto/md2/md2test.c @@ -129,7 +129,7 @@ static char *pt(unsigned char *md) static char buf[80]; for (i=0; itime); - sprintf(bufp, "[%02d:%02d:%02d] ", + snprintf(bufp, sizeof(buf) - (bufp - buf), "[%02d:%02d:%02d] ", lcl->tm_hour,lcl->tm_min,lcl->tm_sec); bufp += strlen(bufp); } - sprintf(bufp, "%5lu file=%s, line=%d, ", + snprintf(bufp, sizeof(buf) - (bufp - buf), "%5lu file=%s, line=%d, ", m->order,m->file,m->line); bufp += strlen(bufp); if (options & V_CRYPTO_MDEBUG_THREAD) { - sprintf(bufp, "thread=%lu, ", m->thread); + snprintf(bufp, sizeof(buf) - (bufp - buf), "thread=%lu, ", + m->thread); bufp += strlen(bufp); } - sprintf(bufp, "number=%d, address=%08lX\n", + snprintf(bufp, sizeof(buf) - (bufp - buf), "number=%d, address=%08lX\n", m->num,(unsigned long)m->addr); bufp += strlen(bufp); @@ -623,7 +624,7 @@ static void print_leak(MEM *m, MEM_LEAK *l) ami_cnt++; memset(buf,'>',ami_cnt); - sprintf(buf + ami_cnt, + snprintf(buf + ami_cnt, sizeof(buf) - ami_cnt, " thread=%lu, file=%s, line=%d, info=\"", amip->thread, amip->file, amip->line); buf_len=strlen(buf); @@ -635,10 +636,11 @@ static void print_leak(MEM *m, MEM_LEAK *l) } else { - strcpy(buf + buf_len, amip->info); + strlcpy(buf + buf_len, amip->info, + sizeof(buf) - buf_len); buf_len = strlen(buf); } - sprintf(buf + buf_len, "\"\n"); + snprintf(buf + buf_len, sizeof(buf) - buf_len, "\"\n"); BIO_puts(l->bio,buf); @@ -672,7 +674,7 @@ void CRYPTO_mem_leaks(BIO *b) lh_doall_arg(mh,(void (*)())print_leak,(char *)&ml); if (ml.chunks != 0) { - sprintf(buf,"%ld bytes leaked in %d chunks\n", + snprintf(buf, sizeof(buf), "%ld bytes leaked in %d chunks\n", ml.bytes,ml.chunks); BIO_puts(b,buf); } diff --git a/crypto/dist/openssl/crypto/objects/obj_dat.c b/crypto/dist/openssl/crypto/objects/obj_dat.c index 41fdf6e7b2cc..d9a4ba169a77 100644 --- a/crypto/dist/openssl/crypto/objects/obj_dat.c +++ b/crypto/dist/openssl/crypto/objects/obj_dat.c @@ -454,7 +454,7 @@ int OBJ_obj2txt(char *buf, int buf_len, ASN1_OBJECT *a, int no_name) if (i > 2) i=2; l-=(long)(i*40); - sprintf(tbuf,"%d.%lu",i,l); + snprintf(tbuf, sizeof(tbuf), "%d.%lu", i, l); i=strlen(tbuf); strncpy(buf,tbuf,buf_len); buf_len-=i; @@ -465,7 +465,7 @@ int OBJ_obj2txt(char *buf, int buf_len, ASN1_OBJECT *a, int no_name) for (; idx 0) strncpy(buf,tbuf,buf_len); diff --git a/crypto/dist/openssl/crypto/pkcs12/p12_decr.c b/crypto/dist/openssl/crypto/pkcs12/p12_decr.c index 8cd7e2f41470..e310d6d35c9f 100644 --- a/crypto/dist/openssl/crypto/pkcs12/p12_decr.c +++ b/crypto/dist/openssl/crypto/pkcs12/p12_decr.c @@ -128,7 +128,7 @@ char * PKCS12_decrypt_d2i (X509_ALGOR *algor, char * (*d2i)(), char fname[30]; static int fnm = 1; - sprintf(fname, "DER%d", fnm++); + snprintf(fname, sizeof(fname), "DER%d", fnm++); op = fopen(fname, "wb"); fwrite (p, 1, outlen, op); fclose(op); diff --git a/crypto/dist/openssl/crypto/pkcs7/bio_ber.c b/crypto/dist/openssl/crypto/pkcs7/bio_ber.c index 5447e6981861..da4985ac414a 100644 --- a/crypto/dist/openssl/crypto/pkcs7/bio_ber.c +++ b/crypto/dist/openssl/crypto/pkcs7/bio_ber.c @@ -215,7 +215,7 @@ int bio_ber_get_header(BIO *bio, BIO_BER_CTX *ctx) if ((ctx->tag >= 0) && (ctx->tag != tag)) { BIOerr(BIO_F_BIO_BER_GET_HEADER,BIO_R_TAG_MISMATCH); - sprintf(buf,"tag=%d, got %d",ctx->tag,tag); + snprintf(buf, sizeof(buf), "tag=%d, got %d", ctx->tag, tag); ERR_add_error_data(1,buf); return(-1); } diff --git a/crypto/dist/openssl/crypto/rand/rand_egd.c b/crypto/dist/openssl/crypto/rand/rand_egd.c index a6601696ad9e..f29fb7747aa1 100644 --- a/crypto/dist/openssl/crypto/rand/rand_egd.c +++ b/crypto/dist/openssl/crypto/rand/rand_egd.c @@ -104,7 +104,7 @@ int RAND_egd(const char *path) addr.sun_family = AF_UNIX; if (strlen(path) > sizeof(addr.sun_path)) return (-1); - strcpy(addr.sun_path,path); + strlcpy(addr.sun_path, path, sizeof(addr.sun_path)); len = offsetof(struct sockaddr_un, sun_path) + strlen(path); fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd == -1) return (-1); @@ -136,7 +136,7 @@ int RAND_egd_bytes(const char *path,int bytes) addr.sun_family = AF_UNIX; if (strlen(path) > sizeof(addr.sun_path)) return (-1); - strcpy(addr.sun_path,path); + strlcpy(addr.sun_path, path, sizeof(addr.sun_path)); len = offsetof(struct sockaddr_un, sun_path) + strlen(path); fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd == -1) return (-1); diff --git a/crypto/dist/openssl/crypto/ripemd/rmdtest.c b/crypto/dist/openssl/crypto/ripemd/rmdtest.c index 5d79c997253b..fe9fa1e58743 100644 --- a/crypto/dist/openssl/crypto/ripemd/rmdtest.c +++ b/crypto/dist/openssl/crypto/ripemd/rmdtest.c @@ -134,7 +134,7 @@ static char *pt(unsigned char *md) static char buf[80]; for (i=0; i", &ret); break; } - sprintf(oline, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); + snprintf(oline, sizeof(oline), "%d.%d.%d.%d", + p[0], p[1], p[2], p[3]); X509V3_add_value("IP Address",oline, &ret); break; diff --git a/crypto/dist/openssl/crypto/x509v3/v3_info.c b/crypto/dist/openssl/crypto/x509v3/v3_info.c index a045a629ee7e..b2337825ee80 100644 --- a/crypto/dist/openssl/crypto/x509v3/v3_info.c +++ b/crypto/dist/openssl/crypto/x509v3/v3_info.c @@ -88,21 +88,23 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD *method int i; char objtmp[80], *ntmp; CONF_VALUE *vtmp; + size_t l; for(i = 0; i < sk_ACCESS_DESCRIPTION_num(ainfo); i++) { desc = sk_ACCESS_DESCRIPTION_value(ainfo, i); ret = i2v_GENERAL_NAME(method, desc->location, ret); if(!ret) break; vtmp = sk_CONF_VALUE_value(ret, i); i2t_ASN1_OBJECT(objtmp, 80, desc->method); - ntmp = OPENSSL_malloc(strlen(objtmp) + strlen(vtmp->name) + 5); + ntmp = OPENSSL_malloc(l = strlen(objtmp) + + strlen(vtmp->name) + 5); if(!ntmp) { X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS, ERR_R_MALLOC_FAILURE); return NULL; } - strcpy(ntmp, objtmp); - strcat(ntmp, " - "); - strcat(ntmp, vtmp->name); + strlcpy(ntmp, objtmp, l); + strlcat(ntmp, " - ", l); + strlcat(ntmp, vtmp->name, l); OPENSSL_free(vtmp->name); vtmp->name = ntmp; diff --git a/crypto/dist/openssl/openssl-unifdef.pl b/crypto/dist/openssl/openssl-unifdef.pl index d8764b211f7d..831ecbcf7357 100644 --- a/crypto/dist/openssl/openssl-unifdef.pl +++ b/crypto/dist/openssl/openssl-unifdef.pl @@ -37,18 +37,89 @@ NO_SSL3 NO_STACK NO_STDIO NO_X509 +OPENSSL_NO_AES +OPENSSL_NO_BF +OPENSSL_NO_BIO +OPENSSL_NO_CAST +OPENSSL_NO_COMP +OPENSSL_NO_DES +OPENSSL_NO_DH +OPENSSL_NO_DSA +OPENSSL_NO_ENGINE +OPENSSL_NO_FP_API +OPENSSL_NO_IDEA +OPENSSL_NO_LOCKING +OPENSSL_NO_MD2 +OPENSSL_NO_MD4 +OPENSSL_NO_MD5 +OPENSSL_NO_MDC2 +OPENSSL_NO_RC2 +OPENSSL_NO_RC4 +OPENSSL_NO_RC5 +OPENSSL_NO_RMD160 +OPENSSL_NO_RSA +OPENSSL_NO_SHA +OPENSSL_NO_SHA1 +OPENSSL_NO_SOCK +OPENSSL_NO_SSL2 +OPENSSL_NO_SPEED +OPENSSL_NO_STDIO +OPENSSL_NO_X509 +OPENSSL_SYS_AIX +OPENSSL_SYS_CRAY +OPENSSL_SYS_LINUX +OPENSSL_SYS_MACINTOSH_CLASSIC +OPENSSL_SYS_MACOSX +OPENSSL_SYS_MACOSX_RHAPSODY +OPENSSL_SYS_MPE +OPENSSL_SYS_MSDOS +OPENSSL_SYS_NEWS4 +OPENSSL_SYS_OS2 +OPENSSL_SYS_SNI +OPENSSL_SYS_SUNOS +OPENSSL_SYS_ULTRASPARC +OPENSSL_SYS_VMS +OPENSSL_SYS_VMS_DECC +OPENSSL_SYS_VMS_DECCXX +OPENSSL_SYS_VMS_NODECC +OPENSSL_SYS_VXWORKS +OPENSSL_SYS_WIN16 +OPENSSL_SYS_WIN32 +OPENSSL_SYS_WIN32_CYGWIN +OPENSSL_SYS_WIN32_UWIN +OPENSSL_SYS_WINCE +OPENSSL_SYS_WINDOWS +OPENSSL_SYS_WINNT +OPENSSL_NO_KRB5 PEDANTIC EOF -$unifdef = $unifdef0; -$unifdef =~ s/\n$//; -$unifdef =~ s/^/-U/; -$unifdef =~ s/\n/\n-U/g; -$unifdef =~ s/\n/ /g; -$unifdef =~ join("\n", $unifdef); +#$unifdef1 = <$tmp\n"; print "mv $tmp $i\n"; } + +#unifdef =~ s/-D/-DOPENSSL_/; +$files = `find . -name \\\*.h -type f -print | grep -v MacOS`; +foreach $i (split(/[\n ]/, $files)) { + print "unifdef $unifdef <$i >$tmp\n"; + print "mv $tmp $i\n"; +} +