@@ -42,7 +42,8 @@ __DATA__
42
42
return
43
43
end
44
44
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)
46
47
if not url then
47
48
ngx.log(ngx.ERR, "failed to get OCSP responder: ", err)
48
49
return
@@ -502,7 +503,8 @@ still get an error: truncated
502
503
return
503
504
end
504
505
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)
506
508
if not req then
507
509
ngx.log(ngx.ERR, "failed to create OCSP request: ", err)
508
510
return
@@ -959,7 +961,8 @@ OCSP response validation ok
959
961
local resp = f:read("*a")
960
962
f:close()
961
963
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)
963
966
if not req then
964
967
ngx.log(ngx.ERR, "failed to validate OCSP response: ", err)
965
968
return
@@ -1239,7 +1242,8 @@ OCSP response validation ok
1239
1242
local resp = f:read("*a")
1240
1243
f:close()
1241
1244
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)
1243
1247
if not req then
1244
1248
ngx.log(ngx.ERR, "failed to validate OCSP response: ", err)
1245
1249
return
@@ -1331,7 +1335,8 @@ OCSP response validation ok
1331
1335
local resp = f:read("*a")
1332
1336
f:close()
1333
1337
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)
1335
1340
if not req then
1336
1341
ngx.log(ngx.ERR, "failed to validate OCSP response: ", err)
1337
1342
return ngx.exit(ngx.ERROR)
0 commit comments