summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorderaadt <>2003-04-26 18:06:46 +0000
committerderaadt <>2003-04-26 18:06:46 +0000
commit93094b52ab80eaa8ec649868cd4242a767f67a5d (patch)
treef4d8ed9e79e0482de7a20698db389a92d4391cf4 /src
parent8c81d88b093cc703f9fe284fe5fd6c2ab317bf8f (diff)
downloadopenbsd-93094b52ab80eaa8ec649868cd4242a767f67a5d.tar.gz
openbsd-93094b52ab80eaa8ec649868cd4242a767f67a5d.tar.bz2
openbsd-93094b52ab80eaa8ec649868cd4242a767f67a5d.zip
string cleaning; ok tedu
Diffstat (limited to 'src')
-rw-r--r--src/lib/libssl/src/apps/ca.c32
-rw-r--r--src/lib/libssl/src/apps/engine.c4
2 files changed, 20 insertions, 16 deletions
diff --git a/src/lib/libssl/src/apps/ca.c b/src/lib/libssl/src/apps/ca.c
index 204974eeea..60bc4e5191 100644
--- a/src/lib/libssl/src/apps/ca.c
+++ b/src/lib/libssl/src/apps/ca.c
@@ -575,9 +575,9 @@ bad:
575 strncpy(buf[0],X509_get_default_cert_area(), 575 strncpy(buf[0],X509_get_default_cert_area(),
576 sizeof(buf[0])-2-sizeof(CONFIG_FILE)); 576 sizeof(buf[0])-2-sizeof(CONFIG_FILE));
577 buf[0][sizeof(buf[0])-2-sizeof(CONFIG_FILE)]='\0'; 577 buf[0][sizeof(buf[0])-2-sizeof(CONFIG_FILE)]='\0';
578 strcat(buf[0],"/"); 578 strlcat(buf[0],"/",sizeof(buf[0]));
579#endif 579#endif
580 strcat(buf[0],CONFIG_FILE); 580 strlcat(buf[0],CONFIG_FILE,sizeof(buf[0]));
581 configfile=buf[0]; 581 configfile=buf[0];
582 } 582 }
583 583
@@ -1286,7 +1286,7 @@ bad:
1286#ifdef OPENSSL_SYS_VMS 1286#ifdef OPENSSL_SYS_VMS
1287 strcat(buf[0],"-new"); 1287 strcat(buf[0],"-new");
1288#else 1288#else
1289 strcat(buf[0],".new"); 1289 strlcat(buf[0],".new",sizeof(buf[0]));
1290#endif 1290#endif
1291 1291
1292 if (!save_serial(buf[0],serial)) goto err; 1292 if (!save_serial(buf[0],serial)) goto err;
@@ -1297,7 +1297,7 @@ bad:
1297#ifdef OPENSSL_SYS_VMS 1297#ifdef OPENSSL_SYS_VMS
1298 strcat(buf[1],"-new"); 1298 strcat(buf[1],"-new");
1299#else 1299#else
1300 strcat(buf[1],".new"); 1300 strlcat(buf[1],".new",sizeof(buf[1]));
1301#endif 1301#endif
1302 1302
1303 if (BIO_write_filename(out,buf[1]) <= 0) 1303 if (BIO_write_filename(out,buf[1]) <= 0)
@@ -1315,7 +1315,7 @@ bad:
1315 for (i=0; i<sk_X509_num(cert_sk); i++) 1315 for (i=0; i<sk_X509_num(cert_sk); i++)
1316 { 1316 {
1317 int k; 1317 int k;
1318 unsigned char *n; 1318 char *n;
1319 1319
1320 x=sk_X509_value(cert_sk,i); 1320 x=sk_X509_value(cert_sk,i);
1321 1321
@@ -1326,15 +1326,19 @@ bad:
1326 buf[2][BSIZE-(j*2)-6]='\0'; 1326 buf[2][BSIZE-(j*2)-6]='\0';
1327 1327
1328#ifndef OPENSSL_SYS_VMS 1328#ifndef OPENSSL_SYS_VMS
1329 strcat(buf[2],"/"); 1329 strlcat(buf[2],"/",sizeof(buf[2]));
1330#endif 1330#endif
1331 1331
1332 n=(unsigned char *)&(buf[2][strlen(buf[2])]); 1332 n=(char *)&(buf[2][strlen(buf[2])]);
1333 if (j > 0) 1333 if (j > 0)
1334 { 1334 {
1335 for (k=0; k<j; k++) 1335 for (k=0; k<j; k++)
1336 { 1336 {
1337 sprintf((char *)n,"%02X",(unsigned char)*(p++)); 1337 if (n >= &(buf[2][sizeof(buf[2])]))
1338 break;
1339 snprintf(n,
1340 &buf[2][0] + sizeof(buf[2]) - n,
1341 "%02X",(unsigned char)*(p++));
1338 n+=2; 1342 n+=2;
1339 } 1343 }
1340 } 1344 }
@@ -1366,7 +1370,7 @@ bad:
1366#ifdef OPENSSL_SYS_VMS 1370#ifdef OPENSSL_SYS_VMS
1367 strcat(buf[2],"-old"); 1371 strcat(buf[2],"-old");
1368#else 1372#else
1369 strcat(buf[2],".old"); 1373 strlcat(buf[2],".old",sizeof(buf[2]));
1370#endif 1374#endif
1371 1375
1372 BIO_free(in); 1376 BIO_free(in);
@@ -1395,7 +1399,7 @@ bad:
1395#ifdef OPENSSL_SYS_VMS 1399#ifdef OPENSSL_SYS_VMS
1396 strcat(buf[2],"-old"); 1400 strcat(buf[2],"-old");
1397#else 1401#else
1398 strcat(buf[2],".old"); 1402 strlcat(buf[2],".old",sizeof(buf[2]));
1399#endif 1403#endif
1400 1404
1401 if (rename(dbfile,buf[2]) < 0) 1405 if (rename(dbfile,buf[2]) < 0)
@@ -1560,7 +1564,7 @@ bad:
1560 strncpy(buf[0],dbfile,BSIZE-4); 1564 strncpy(buf[0],dbfile,BSIZE-4);
1561 buf[0][BSIZE-4]='\0'; 1565 buf[0][BSIZE-4]='\0';
1562#ifndef OPENSSL_SYS_VMS 1566#ifndef OPENSSL_SYS_VMS
1563 strcat(buf[0],".new"); 1567 strlcat(buf[0],".new",sizeof(buf[0]));
1564#else 1568#else
1565 strcat(buf[0],"-new"); 1569 strcat(buf[0],"-new");
1566#endif 1570#endif
@@ -1579,7 +1583,7 @@ bad:
1579 strncpy(buf[1],dbfile,BSIZE-4); 1583 strncpy(buf[1],dbfile,BSIZE-4);
1580 buf[1][BSIZE-4]='\0'; 1584 buf[1][BSIZE-4]='\0';
1581#ifndef OPENSSL_SYS_VMS 1585#ifndef OPENSSL_SYS_VMS
1582 strcat(buf[1],".old"); 1586 strlcat(buf[1],".old",sizeof(buf[1]));
1583#else 1587#else
1584 strcat(buf[1],"-old"); 1588 strcat(buf[1],"-old");
1585#endif 1589#endif
@@ -2311,7 +2315,7 @@ again2:
2311 BIO_printf(bio_err,"Memory allocation failure\n"); 2315 BIO_printf(bio_err,"Memory allocation failure\n");
2312 goto err; 2316 goto err;
2313 } 2317 }
2314 strcpy(row[DB_file],"unknown"); 2318 strlcpy(row[DB_file],"unknown",8);
2315 row[DB_type][0]='V'; 2319 row[DB_type][0]='V';
2316 row[DB_type][1]='\0'; 2320 row[DB_type][1]='\0';
2317 2321
@@ -2609,7 +2613,7 @@ static int do_revoke(X509 *x509, TXT_DB *db, int type, char *value)
2609 BIO_printf(bio_err,"Memory allocation failure\n"); 2613 BIO_printf(bio_err,"Memory allocation failure\n");
2610 goto err; 2614 goto err;
2611 } 2615 }
2612 strcpy(row[DB_file],"unknown"); 2616 strlcpy(row[DB_file],"unknown",8);
2613 row[DB_type][0]='V'; 2617 row[DB_type][0]='V';
2614 row[DB_type][1]='\0'; 2618 row[DB_type][1]='\0';
2615 2619
diff --git a/src/lib/libssl/src/apps/engine.c b/src/lib/libssl/src/apps/engine.c
index 734ecb3e5d..3c94c3c4ed 100644
--- a/src/lib/libssl/src/apps/engine.c
+++ b/src/lib/libssl/src/apps/engine.c
@@ -120,8 +120,8 @@ static int append_buf(char **buf, const char *s, int *size, int step)
120 return 0; 120 return 0;
121 121
122 if (**buf != '\0') 122 if (**buf != '\0')
123 strcat(*buf, ", "); 123 strlcat(*buf, ", ", *size);
124 strcat(*buf, s); 124 strlcat(*buf, s, *size);
125 125
126 return 1; 126 return 1;
127 } 127 }