@@ -42,7 +42,8 @@ __DATA__
4242 return
4343 end
4444
45- local url, err = ocsp.get_ocsp_responder_from_der_chain(cert_data)
45+ -- specify the max length explicitly here, since string buf size may be too short
46+ local url, err = ocsp.get_ocsp_responder_from_der_chain(cert_data, 128)
4647 if not url then
4748 ngx.log(ngx.ERR, "failed to get OCSP responder: ", err)
4849 return
@@ -502,7 +503,8 @@ still get an error: truncated
502503 return
503504 end
504505
505- local req, err = ocsp.create_ocsp_request(cert_data)
506+ -- specify the max length explicitly here, since string buf size may be too short
507+ local req, err = ocsp.create_ocsp_request(cert_data, 128)
506508 if not req then
507509 ngx.log(ngx.ERR, "failed to create OCSP request: ", err)
508510 return
@@ -959,7 +961,8 @@ OCSP response validation ok
959961 local resp = f:read("*a")
960962 f:close()
961963
962- local req, err = ocsp.validate_ocsp_response(resp, cert_data)
964+ -- specify the max length explicitly here, since string buf size may be too short
965+ local req, err = ocsp.validate_ocsp_response(resp, cert_data, 128)
963966 if not req then
964967 ngx.log(ngx.ERR, "failed to validate OCSP response: ", err)
965968 return
@@ -1239,7 +1242,8 @@ OCSP response validation ok
12391242 local resp = f:read("*a")
12401243 f:close()
12411244
1242- local req, err = ocsp.validate_ocsp_response(resp, cert_data)
1245+ -- specify the max length explicitly here, since string buf size may be too short
1246+ local req, err = ocsp.validate_ocsp_response(resp, cert_data, 128)
12431247 if not req then
12441248 ngx.log(ngx.ERR, "failed to validate OCSP response: ", err)
12451249 return
@@ -1331,7 +1335,8 @@ OCSP response validation ok
13311335 local resp = f:read("*a")
13321336 f:close()
13331337
1334- local req, err = ocsp.validate_ocsp_response(resp, cert_data)
1338+ -- specify the max length explicitly here, since string buf size may be too short
1339+ local req, err = ocsp.validate_ocsp_response(resp, cert_data, 128)
13351340 if not req then
13361341 ngx.log(ngx.ERR, "failed to validate OCSP response: ", err)
13371342 return ngx.exit(ngx.ERROR)
0 commit comments