Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bugfix: there were various places where we did not check the pointer …

…returned by the memory allocator.
  • Loading branch information...
commit 29e8b41e99d433a5327039de7025c6c7c398ce6f 1 parent b35bcb2
@agentzh agentzh authored
View
4 src/ngx_http_lua_args.c
@@ -41,6 +41,10 @@ ngx_http_lua_ngx_req_set_uri_args(lua_State *L) {
p = (u_char *) lua_tolstring(L, 1, &len);
args.data = ngx_palloc(r->pool, len);
+ if (args.data == NULL) {
+ return luaL_error(L, "out of memory");
+ }
+
ngx_memcpy(args.data, p, len);
args.len = len;
View
8 src/ngx_http_lua_control.c
@@ -69,6 +69,10 @@ ngx_http_lua_ngx_exec(lua_State *L)
}
uri.data = ngx_palloc(r->pool, len);
+ if (uri.data == NULL) {
+ return luaL_error(L, "out of memory");
+ }
+
ngx_memcpy(uri.data, p, len);
uri.len = len;
@@ -91,6 +95,10 @@ ngx_http_lua_ngx_exec(lua_State *L)
p = (u_char *) lua_tolstring(L, 2, &len);
user_args.data = ngx_palloc(r->pool, len);
+ if (user_args.data == NULL) {
+ return luaL_error(L, "out of memory");
+ }
+
ngx_memcpy(user_args.data, p, len);
user_args.len = len;
View
4 src/ngx_http_lua_uri.c
@@ -50,6 +50,10 @@ ngx_http_lua_ngx_req_set_uri(lua_State *L)
}
r->uri.data = ngx_palloc(r->pool, len);
+ if (r->uri.data == NULL) {
+ return luaL_error(L, "out of memory");
+ }
+
ngx_memcpy(r->uri.data, p, len);
r->uri.len = len;
View
2  src/ngx_http_lua_util.c
@@ -1791,7 +1791,7 @@ ngx_http_lua_process_args_option(ngx_http_request_t *r, lua_State *L,
dd("len 1: %d", (int) len);
p = ngx_palloc(r->pool, len);
- if (p == 0) {
+ if (p == NULL) {
luaL_error(L, "out of memory");
return;
}
Please sign in to comment.
Something went wrong with that request. Please try again.