Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
fc3cec53
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
接近 2 年 前同步成功
通知
12
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fc3cec53
编写于
5月 01, 2015
作者:
R
Rich Salz
提交者:
Rich Salz
5月 13, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix ocsp bugs
Various bugs found by Viktor, Emilia, Matt, etc. Reviewed-by:
N
Matt Caswell
<
matt@openssl.org
>
上级
580139bd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
21 deletion
+37
-21
apps/ocsp.c
apps/ocsp.c
+37
-21
未找到文件。
apps/ocsp.c
浏览文件 @
fc3cec53
...
...
@@ -1035,21 +1035,26 @@ static BIO *init_responder(const char *port)
}
static
char
*
urldecode
(
char
*
p
)
/*
* Decode %xx URL-decoding in-place. Ignores mal-formed sequences.
*/
static
int
urldecode
(
char
*
p
)
{
unsigned
char
*
out
=
(
unsigned
char
*
)
p
;
char
*
save
=
p
;
unsigned
char
*
save
=
out
;
for
(;
*
p
;
p
++
)
{
if
(
*
p
!=
'%'
)
*
out
++
=
*
p
;
else
if
(
p
[
1
]
&&
p
[
2
]
)
{
else
if
(
isxdigit
(
p
[
1
])
&&
isxdigit
(
p
[
2
])
)
{
*
out
++
=
(
app_hex
(
p
[
1
])
<<
4
)
|
app_hex
(
p
[
2
]);
p
+=
2
;
}
else
return
-
1
;
}
*
p
=
'\0'
;
return
save
;
*
out
=
'\0'
;
return
(
int
)(
out
-
save
)
;
}
static
int
do_responder
(
OCSP_REQUEST
**
preq
,
BIO
**
pcbio
,
BIO
*
acbio
,
...
...
@@ -1057,7 +1062,7 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio,
{
int
len
;
OCSP_REQUEST
*
req
=
NULL
;
char
inbuf
[
2048
];
char
inbuf
[
2048
]
,
reqbuf
[
2048
]
;
char
*
p
,
*
q
;
BIO
*
cbio
=
NULL
,
*
getbio
=
NULL
,
*
b64
=
NULL
;
...
...
@@ -1071,40 +1076,51 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio,
*
pcbio
=
cbio
;
/* Read the request line. */
len
=
BIO_gets
(
cbio
,
inbuf
,
sizeof
in
buf
);
len
=
BIO_gets
(
cbio
,
reqbuf
,
sizeof
req
buf
);
if
(
len
<=
0
)
return
1
;
if
(
strncmp
(
inbuf
,
"GET"
,
3
)
==
0
)
{
if
(
strncmp
(
reqbuf
,
"GET "
,
4
)
==
0
)
{
/* Expecting GET {sp} /URL {sp} HTTP/1.x */
for
(
p
=
inbuf
+
3
;
*
p
==
' '
||
*
p
==
'\t
'
;
++
p
)
for
(
p
=
reqbuf
+
4
;
*
p
==
'
'
;
++
p
)
continue
;
if
(
*
p
)
{
/* Move past the slash before the URL part. */
p
++
;
if
(
*
p
!=
'/'
)
{
BIO_printf
(
bio_err
,
"Invalid request -- bad URL
\n
"
);
return
1
;
}
p
++
;
/* Splice off the HTTP version identifier. */
for
(
q
=
p
;
*
q
;
q
++
)
if
(
*
q
==
' '
||
*
q
==
'\t'
)
if
(
*
q
==
' '
)
break
;
if
(
*
q
==
'\0'
)
{
BIO_printf
(
bio_err
,
"Invalid request
\n
"
);
if
(
strncmp
(
q
,
" HTTP/1."
,
8
)
!=
0
)
{
BIO_printf
(
bio_err
,
"Invalid request
-- bad HTTP vesion
\n
"
);
return
1
;
}
*
q
=
'\0'
;
p
=
urldecode
(
p
);
getbio
=
BIO_new_mem_buf
(
p
,
strlen
(
p
));
b64
=
BIO_new
(
BIO_f_base64
());
len
=
urldecode
(
p
);
if
(
len
<=
0
)
{
BIO_printf
(
bio_err
,
"Invalid request -- bad URL encoding
\n
"
);
return
1
;
}
if
((
getbio
=
BIO_new_mem_buf
(
p
,
len
))
==
NULL
||
(
b64
=
BIO_new
(
BIO_f_base64
()))
==
NULL
)
{
BIO_printf
(
bio_err
,
"Could not allocate memory
\n
"
);
ERR_print_errors
(
bio_err
);
return
1
;
}
BIO_set_flags
(
b64
,
BIO_FLAGS_BASE64_NO_NL
);
getbio
=
BIO_push
(
b64
,
getbio
);
}
else
if
(
strncmp
(
inbuf
,
"POST"
,
4
)
!=
0
)
{
BIO_printf
(
bio_err
,
"Invalid request
\n
"
);
}
else
if
(
strncmp
(
reqbuf
,
"POST "
,
5
)
!=
0
)
{
BIO_printf
(
bio_err
,
"Invalid request
-- bad HTTP verb
\n
"
);
return
1
;
}
/* Read and skip past the headers. */
for
(;;)
{
len
=
BIO_gets
(
cbio
,
inbuf
,
sizeof
inbuf
);
if
(
len
<=
0
)
return
1
;
/* Look for end of headers */
if
((
inbuf
[
0
]
==
'\r'
)
||
(
inbuf
[
0
]
==
'\n'
))
break
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录