Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/dist/openssl/crypto use bounded string op (only one s...



details:   https://anonhg.NetBSD.org/src/rev/44a435006bde
branches:  trunk
changeset: 549450:44a435006bde
user:      itojun <itojun%NetBSD.org@localhost>
date:      Mon Jul 14 13:24:00 2003 +0000

description:
use bounded string op (only one sprintf remains - still no clue)

diffstat:

 crypto/dist/openssl/crypto/pem/pem_lib.c |  12 ++++++------
 crypto/dist/openssl/crypto/x509/by_dir.c |   4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (43 lines):

diff -r 149c1cad124a -r 44a435006bde crypto/dist/openssl/crypto/pem/pem_lib.c
--- a/crypto/dist/openssl/crypto/pem/pem_lib.c  Mon Jul 14 13:07:05 2003 +0000
+++ b/crypto/dist/openssl/crypto/pem/pem_lib.c  Mon Jul 14 13:24:00 2003 +0000
@@ -140,9 +140,9 @@
        else
                str="BAD-TYPE";
                
-       strcat(buf,"Proc-Type: 4,");
-       strcat(buf,str);
-       strcat(buf,"\n");
+       strlcat(buf, "Proc-Type: 4,", PEM_BUFSIZE);
+       strlcat(buf, str, PEM_BUFSIZE);
+       strlcat(buf, "\n", PEM_BUFSIZE);
        }
 
 void PEM_dek_info(char *buf, const char *type, int len, char *str)
@@ -151,9 +151,9 @@
        long i;
        int j;
 
-       strcat(buf,"DEK-Info: ");
-       strcat(buf,type);
-       strcat(buf,",");
+       strlcat(buf, "DEK-Info: ", PEM_BUFSIZE);
+       strlcat(buf, type, PEM_BUFSIZE);
+       strlcat(buf, ",", PEM_BUFSIZE);
        j=strlen(buf);
        for (i=0; i<len; i++)
                {
diff -r 149c1cad124a -r 44a435006bde crypto/dist/openssl/crypto/x509/by_dir.c
--- a/crypto/dist/openssl/crypto/x509/by_dir.c  Mon Jul 14 13:07:05 2003 +0000
+++ b/crypto/dist/openssl/crypto/x509/by_dir.c  Mon Jul 14 13:24:00 2003 +0000
@@ -302,8 +302,8 @@
                k=0;
                for (;;)
                        {
-                       sprintf(b->data,"%s/%08lx.%s%d",ctx->dirs[i],h,
-                               postfix,k);
+                       snprintf(b->data, b->max, "%s/%08lx.%s%d",
+                           ctx->dirs[i], h, postfix, k);
                        k++;
                        if (stat(b->data,&st) < 0)
                                break;



Home | Main Index | Thread Index | Old Index