Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
openssl
提交
7c0ef843
O
openssl
项目概览
btwise
/
openssl
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7c0ef843
编写于
5月 11, 2016
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't leak memory if realloc fails.
RT#4403 Reviewed-by:
N
Viktor Dukhovni
<
viktor@openssl.org
>
上级
3dfcb6a0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
27 addition
and
18 deletion
+27
-18
apps/apps.c
apps/apps.c
+4
-5
apps/engine.c
apps/engine.c
+8
-4
crypto/modes/ocb128.c
crypto/modes/ocb128.c
+4
-2
ssl/ssl_rsa.c
ssl/ssl_rsa.c
+4
-2
ssl/t1_ext.c
ssl/t1_ext.c
+7
-5
未找到文件。
apps/apps.c
浏览文件 @
7c0ef843
...
@@ -176,8 +176,6 @@ int chopup_args(ARGS *arg, char *buf)
...
@@ -176,8 +176,6 @@ int chopup_args(ARGS *arg, char *buf)
if
(
arg
->
size
==
0
)
{
if
(
arg
->
size
==
0
)
{
arg
->
size
=
20
;
arg
->
size
=
20
;
arg
->
argv
=
app_malloc
(
sizeof
(
*
arg
->
argv
)
*
arg
->
size
,
"argv space"
);
arg
->
argv
=
app_malloc
(
sizeof
(
*
arg
->
argv
)
*
arg
->
size
,
"argv space"
);
if
(
arg
->
argv
==
NULL
)
return
0
;
}
}
for
(
p
=
buf
;;)
{
for
(
p
=
buf
;;)
{
...
@@ -189,11 +187,12 @@ int chopup_args(ARGS *arg, char *buf)
...
@@ -189,11 +187,12 @@ int chopup_args(ARGS *arg, char *buf)
/* The start of something good :-) */
/* The start of something good :-) */
if
(
arg
->
argc
>=
arg
->
size
)
{
if
(
arg
->
argc
>=
arg
->
size
)
{
char
**
tmp
;
arg
->
size
+=
20
;
arg
->
size
+=
20
;
arg
->
argv
=
OPENSSL_realloc
(
arg
->
argv
,
tmp
=
OPENSSL_realloc
(
arg
->
argv
,
sizeof
(
*
arg
->
argv
)
*
arg
->
size
);
sizeof
(
*
arg
->
argv
)
*
arg
->
size
);
if
(
tmp
==
NULL
)
if
(
arg
->
argv
==
NULL
)
return
0
;
return
0
;
arg
->
argv
=
tmp
;
}
}
quoted
=
*
p
==
'\''
||
*
p
==
'"'
;
quoted
=
*
p
==
'\''
||
*
p
==
'"'
;
if
(
quoted
)
if
(
quoted
)
...
...
apps/engine.c
浏览文件 @
7c0ef843
...
@@ -107,13 +107,17 @@ static int append_buf(char **buf, int *size, const char *s)
...
@@ -107,13 +107,17 @@ static int append_buf(char **buf, int *size, const char *s)
}
}
if
(
strlen
(
*
buf
)
+
strlen
(
s
)
>=
(
unsigned
int
)
*
size
)
{
if
(
strlen
(
*
buf
)
+
strlen
(
s
)
>=
(
unsigned
int
)
*
size
)
{
char
*
tmp
;
*
size
+=
256
;
*
size
+=
256
;
*
buf
=
OPENSSL_realloc
(
*
buf
,
*
size
);
tmp
=
OPENSSL_realloc
(
*
buf
,
*
size
);
if
(
tmp
==
NULL
)
{
OPENSSL_free
(
*
buf
);
*
buf
=
NULL
;
return
0
;
}
*
buf
=
tmp
;
}
}
if
(
*
buf
==
NULL
)
return
0
;
if
(
**
buf
!=
'\0'
)
if
(
**
buf
!=
'\0'
)
OPENSSL_strlcat
(
*
buf
,
", "
,
*
size
);
OPENSSL_strlcat
(
*
buf
,
", "
,
*
size
);
OPENSSL_strlcat
(
*
buf
,
s
,
*
size
);
OPENSSL_strlcat
(
*
buf
,
s
,
*
size
);
...
...
crypto/modes/ocb128.c
浏览文件 @
7c0ef843
...
@@ -147,6 +147,7 @@ static OCB_BLOCK *ocb_lookup_l(OCB128_CONTEXT *ctx, size_t idx)
...
@@ -147,6 +147,7 @@ static OCB_BLOCK *ocb_lookup_l(OCB128_CONTEXT *ctx, size_t idx)
/* We don't have it - so calculate it */
/* We don't have it - so calculate it */
if
(
idx
>=
ctx
->
max_l_index
)
{
if
(
idx
>=
ctx
->
max_l_index
)
{
void
*
tmp_ptr
;
/*
/*
* Each additional entry allows to process almost double as
* Each additional entry allows to process almost double as
* much data, so that in linear world the table will need to
* much data, so that in linear world the table will need to
...
@@ -157,10 +158,11 @@ static OCB_BLOCK *ocb_lookup_l(OCB128_CONTEXT *ctx, size_t idx)
...
@@ -157,10 +158,11 @@ static OCB_BLOCK *ocb_lookup_l(OCB128_CONTEXT *ctx, size_t idx)
* the index.
* the index.
*/
*/
ctx
->
max_l_index
+=
(
idx
-
ctx
->
max_l_index
+
4
)
&
~
3
;
ctx
->
max_l_index
+=
(
idx
-
ctx
->
max_l_index
+
4
)
&
~
3
;
ctx
->
l
=
tmp_ptr
=
OPENSSL_realloc
(
ctx
->
l
,
ctx
->
max_l_index
*
sizeof
(
OCB_BLOCK
));
OPENSSL_realloc
(
ctx
->
l
,
ctx
->
max_l_index
*
sizeof
(
OCB_BLOCK
));
if
(
ctx
->
l
==
NULL
)
if
(
tmp_ptr
==
NULL
)
/* prevent ctx->l from being clobbered */
return
NULL
;
return
NULL
;
ctx
->
l
=
tmp_ptr
;
}
}
while
(
l_index
<
idx
)
{
while
(
l_index
<
idx
)
{
ocb_double
(
ctx
->
l
+
l_index
,
ctx
->
l
+
l_index
+
1
);
ocb_double
(
ctx
->
l
+
l_index
,
ctx
->
l
+
l_index
+
1
);
...
...
ssl/ssl_rsa.c
浏览文件 @
7c0ef843
...
@@ -940,6 +940,7 @@ int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo,
...
@@ -940,6 +940,7 @@ int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo,
int
SSL_CTX_use_serverinfo_file
(
SSL_CTX
*
ctx
,
const
char
*
file
)
int
SSL_CTX_use_serverinfo_file
(
SSL_CTX
*
ctx
,
const
char
*
file
)
{
{
unsigned
char
*
serverinfo
=
NULL
;
unsigned
char
*
serverinfo
=
NULL
;
unsigned
char
*
tmp
;
size_t
serverinfo_length
=
0
;
size_t
serverinfo_length
=
0
;
unsigned
char
*
extension
=
0
;
unsigned
char
*
extension
=
0
;
long
extension_length
=
0
;
long
extension_length
=
0
;
...
@@ -999,12 +1000,13 @@ int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file)
...
@@ -999,12 +1000,13 @@ int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file)
goto
end
;
goto
end
;
}
}
/* Append the decoded extension to the serverinfo buffer */
/* Append the decoded extension to the serverinfo buffer */
serverinfo
=
tmp
=
OPENSSL_realloc
(
serverinfo
,
serverinfo_length
+
extension_length
);
OPENSSL_realloc
(
serverinfo
,
serverinfo_length
+
extension_length
);
if
(
serverinfo
==
NULL
)
{
if
(
tmp
==
NULL
)
{
SSLerr
(
SSL_F_SSL_CTX_USE_SERVERINFO_FILE
,
ERR_R_MALLOC_FAILURE
);
SSLerr
(
SSL_F_SSL_CTX_USE_SERVERINFO_FILE
,
ERR_R_MALLOC_FAILURE
);
goto
end
;
goto
end
;
}
}
serverinfo
=
tmp
;
memcpy
(
serverinfo
+
serverinfo_length
,
extension
,
extension_length
);
memcpy
(
serverinfo
+
serverinfo_length
,
extension
,
extension_length
);
serverinfo_length
+=
extension_length
;
serverinfo_length
+=
extension_length
;
...
...
ssl/t1_ext.c
浏览文件 @
7c0ef843
...
@@ -205,7 +205,7 @@ static int custom_ext_meth_add(custom_ext_methods *exts,
...
@@ -205,7 +205,7 @@ static int custom_ext_meth_add(custom_ext_methods *exts,
void
*
add_arg
,
void
*
add_arg
,
custom_ext_parse_cb
parse_cb
,
void
*
parse_arg
)
custom_ext_parse_cb
parse_cb
,
void
*
parse_arg
)
{
{
custom_ext_method
*
meth
;
custom_ext_method
*
meth
,
*
tmp
;
/*
/*
* Check application error: if add_cb is not set free_cb will never be
* Check application error: if add_cb is not set free_cb will never be
* called.
* called.
...
@@ -225,15 +225,17 @@ static int custom_ext_meth_add(custom_ext_methods *exts,
...
@@ -225,15 +225,17 @@ static int custom_ext_meth_add(custom_ext_methods *exts,
/* Search for duplicate */
/* Search for duplicate */
if
(
custom_ext_find
(
exts
,
ext_type
))
if
(
custom_ext_find
(
exts
,
ext_type
))
return
0
;
return
0
;
exts
->
meths
=
OPENSSL_realloc
(
exts
->
meths
,
tmp
=
OPENSSL_realloc
(
exts
->
meths
,
(
exts
->
meths_count
+
(
exts
->
meths_count
+
1
)
*
sizeof
(
custom_ext_method
));
1
)
*
sizeof
(
custom_ext_method
));
if
(
!
exts
->
meths
)
{
if
(
tmp
==
NULL
)
{
OPENSSL_free
(
exts
->
meths
);
exts
->
meths
=
NULL
;
exts
->
meths_count
=
0
;
exts
->
meths_count
=
0
;
return
0
;
return
0
;
}
}
exts
->
meths
=
tmp
;
meth
=
exts
->
meths
+
exts
->
meths_count
;
meth
=
exts
->
meths
+
exts
->
meths_count
;
memset
(
meth
,
0
,
sizeof
(
*
meth
));
memset
(
meth
,
0
,
sizeof
(
*
meth
));
meth
->
parse_cb
=
parse_cb
;
meth
->
parse_cb
=
parse_cb
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录