提交 ea46f5e0 编写于 作者: R Richard Levitte

Replace strdup() with BUF_strdup().

上级 7f6c8482
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#include <openssl/conf.h> #include <openssl/conf.h>
#include <openssl/asn1.h> #include <openssl/asn1.h>
#include <openssl/asn1t.h> #include <openssl/asn1t.h>
#include <openssl/buffer.h>
#include <openssl/x509v3.h> #include <openssl/x509v3.h>
#ifndef OPENSSL_NO_RFC3779 #ifndef OPENSSL_NO_RFC3779
...@@ -934,7 +935,7 @@ static void *v2i_IPAddrBlocks(struct v3_ext_method *method, ...@@ -934,7 +935,7 @@ static void *v2i_IPAddrBlocks(struct v3_ext_method *method,
length = length_from_afi(afi); length = length_from_afi(afi);
/* /*
* Handle SAFI, if any, and strdup() so we can null-terminate * Handle SAFI, if any, and BUF_strdup() so we can null-terminate
* the other input values. * the other input values.
*/ */
if (safi != NULL) { if (safi != NULL) {
...@@ -946,9 +947,9 @@ static void *v2i_IPAddrBlocks(struct v3_ext_method *method, ...@@ -946,9 +947,9 @@ static void *v2i_IPAddrBlocks(struct v3_ext_method *method,
goto err; goto err;
} }
t += strspn(t, " \t"); t += strspn(t, " \t");
s = strdup(t); s = BUF_strdup(t);
} else { } else {
s = strdup(val->value); s = BUF_strdup(val->value);
} }
if (s == NULL) { if (s == NULL) {
X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE);
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <openssl/engine.h> #include <openssl/engine.h>
#include <openssl/buffer.h>
#include "gost_lcl.h" #include "gost_lcl.h"
static char *gost_params[GOST_PARAM_MAX+1]={NULL}; static char *gost_params[GOST_PARAM_MAX+1]={NULL};
...@@ -54,7 +55,7 @@ const char *get_gost_engine_param(int param) ...@@ -54,7 +55,7 @@ const char *get_gost_engine_param(int param)
tmp = getenv(gost_envnames[param]); tmp = getenv(gost_envnames[param]);
if (tmp) if (tmp)
{ {
gost_params[param] = strdup(tmp); gost_params[param] = BUF_strdup(tmp);
return gost_params[param]; return gost_params[param];
} }
return NULL; return NULL;
...@@ -68,7 +69,7 @@ int gost_set_default_param(int param, const char *value) ...@@ -68,7 +69,7 @@ int gost_set_default_param(int param, const char *value)
/* if there is value in the environment, use it, else -passed string * */ /* if there is value in the environment, use it, else -passed string * */
if (!tmp) tmp=value; if (!tmp) tmp=value;
if (gost_params[param]) free(gost_params[param]); if (gost_params[param]) free(gost_params[param]);
gost_params[param] = strdup(tmp); gost_params[param] = BUF_strdup(tmp);
return 1; return 1;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册