diff options
author | beck <> | 2014-04-15 22:49:20 +0000 |
---|---|---|
committer | beck <> | 2014-04-15 22:49:20 +0000 |
commit | 46ff0be9ae5a58a1cb67e6e82dca055eee00ffdd (patch) | |
tree | c11befdbb097218db9d9a16976d95e9c1a1229b2 /src | |
parent | 6535feb093f9c9a803483b62eb35b50680802ae1 (diff) | |
download | openbsd-46ff0be9ae5a58a1cb67e6e82dca055eee00ffdd.tar.gz openbsd-46ff0be9ae5a58a1cb67e6e82dca055eee00ffdd.tar.bz2 openbsd-46ff0be9ae5a58a1cb67e6e82dca055eee00ffdd.zip |
remove BIO_snprintf usage - convert to snprintf.
Interestingly this fixes a bug, as the code appears to have been
assuming that BIO_snprintf returns what snprintf does when it does not.
ok tedu@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/src/apps/req.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/lib/libssl/src/apps/req.c b/src/lib/libssl/src/apps/req.c index 4b5c813cef..ede69ed5d8 100644 --- a/src/lib/libssl/src/apps/req.c +++ b/src/lib/libssl/src/apps/req.c | |||
@@ -1230,6 +1230,7 @@ static int prompt_info(X509_REQ *req, | |||
1230 | i= -1; | 1230 | i= -1; |
1231 | start: for (;;) | 1231 | start: for (;;) |
1232 | { | 1232 | { |
1233 | int ret; | ||
1233 | i++; | 1234 | i++; |
1234 | if (sk_CONF_VALUE_num(dn_sk) <= i) break; | 1235 | if (sk_CONF_VALUE_num(dn_sk) <= i) break; |
1235 | 1236 | ||
@@ -1258,8 +1259,8 @@ start: for (;;) | |||
1258 | mval = 0; | 1259 | mval = 0; |
1259 | /* If OBJ not recognised ignore it */ | 1260 | /* If OBJ not recognised ignore it */ |
1260 | if ((nid=OBJ_txt2nid(type)) == NID_undef) goto start; | 1261 | if ((nid=OBJ_txt2nid(type)) == NID_undef) goto start; |
1261 | if (BIO_snprintf(buf,sizeof buf,"%s_default",v->name) | 1262 | ret = snprintf(buf,sizeof buf,"%s_default",v->name); |
1262 | >= (int)sizeof(buf)) | 1263 | if (ret == -1 || ret >= sizeof(buf)) |
1263 | { | 1264 | { |
1264 | BIO_printf(bio_err,"Name '%s' too long\n",v->name); | 1265 | BIO_printf(bio_err,"Name '%s' too long\n",v->name); |
1265 | return 0; | 1266 | return 0; |
@@ -1313,6 +1314,7 @@ start: for (;;) | |||
1313 | i= -1; | 1314 | i= -1; |
1314 | start2: for (;;) | 1315 | start2: for (;;) |
1315 | { | 1316 | { |
1317 | int ret; | ||
1316 | i++; | 1318 | i++; |
1317 | if ((attr_sk == NULL) || | 1319 | if ((attr_sk == NULL) || |
1318 | (sk_CONF_VALUE_num(attr_sk) <= i)) | 1320 | (sk_CONF_VALUE_num(attr_sk) <= i)) |
@@ -1322,9 +1324,8 @@ start2: for (;;) | |||
1322 | type=v->name; | 1324 | type=v->name; |
1323 | if ((nid=OBJ_txt2nid(type)) == NID_undef) | 1325 | if ((nid=OBJ_txt2nid(type)) == NID_undef) |
1324 | goto start2; | 1326 | goto start2; |
1325 | 1327 | ret = snprintf(buf,sizeof buf,"%s_default",type); | |
1326 | if (BIO_snprintf(buf,sizeof buf,"%s_default",type) | 1328 | if (ret == -1 || ret >= sizeof(buf)) |
1327 | >= (int)sizeof(buf)) | ||
1328 | { | 1329 | { |
1329 | BIO_printf(bio_err,"Name '%s' too long\n",v->name); | 1330 | BIO_printf(bio_err,"Name '%s' too long\n",v->name); |
1330 | return 0; | 1331 | return 0; |
@@ -1346,14 +1347,14 @@ start2: for (;;) | |||
1346 | value=NULL; | 1347 | value=NULL; |
1347 | } | 1348 | } |
1348 | 1349 | ||
1349 | BIO_snprintf(buf,sizeof buf,"%s_min",type); | 1350 | (void) snprintf(buf,sizeof buf,"%s_min",type); |
1350 | if (!NCONF_get_number(req_conf,attr_sect,buf, &n_min)) | 1351 | if (!NCONF_get_number(req_conf,attr_sect,buf, &n_min)) |
1351 | { | 1352 | { |
1352 | ERR_clear_error(); | 1353 | ERR_clear_error(); |
1353 | n_min = -1; | 1354 | n_min = -1; |
1354 | } | 1355 | } |
1355 | 1356 | ||
1356 | BIO_snprintf(buf,sizeof buf,"%s_max",type); | 1357 | (void) snprintf(buf,sizeof buf,"%s_max",type); |
1357 | if (!NCONF_get_number(req_conf,attr_sect,buf, &n_max)) | 1358 | if (!NCONF_get_number(req_conf,attr_sect,buf, &n_max)) |
1358 | { | 1359 | { |
1359 | ERR_clear_error(); | 1360 | ERR_clear_error(); |