This is an automated email from the ASF dual-hosted git repository.

kichan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 84bc7ab86a020c1ff418014ac65da9f0483deafc
Author: Matt Mills <mmi...@2bn.net>
AuthorDate: Fri Aug 4 20:44:37 2017 -0600

    Add null pointer check to server response set status
---
 plugins/experimental/ts_lua/ts_lua_server_response.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/plugins/experimental/ts_lua/ts_lua_server_response.c 
b/plugins/experimental/ts_lua/ts_lua_server_response.c
index d3e5338..14501c6 100644
--- a/plugins/experimental/ts_lua/ts_lua_server_response.c
+++ b/plugins/experimental/ts_lua/ts_lua_server_response.c
@@ -291,7 +291,7 @@ ts_lua_server_response_set_status(lua_State *L)
 {
   int status;
   const char *reason;
-  int reason_len;
+  int reason_len = 0;
 
   ts_lua_http_ctx *http_ctx;
 
@@ -302,7 +302,9 @@ ts_lua_server_response_set_status(lua_State *L)
   status = luaL_checkint(L, 1);
 
   reason     = TSHttpHdrReasonLookup(status);
-  reason_len = strlen(reason);
+  if (reason) {
+      reason_len = strlen(reason);
+  }
 
   TSHttpHdrStatusSet(http_ctx->server_response_bufp, 
http_ctx->server_response_hdrp, status);
   TSHttpHdrReasonSet(http_ctx->server_response_bufp, 
http_ctx->server_response_hdrp, reason, reason_len);

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Reply via email to