Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/httpd zero allocated memory buffers



details:   https://anonhg.NetBSD.org/src/rev/1115d977f65c
branches:  trunk
changeset: 790543:1115d977f65c
user:      mbalmer <mbalmer%NetBSD.org@localhost>
date:      Thu Oct 17 07:31:31 2013 +0000

description:
zero allocated memory buffers

diffstat:

 libexec/httpd/lua-bozo.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r e8e51b98799e -r 1115d977f65c libexec/httpd/lua-bozo.c
--- a/libexec/httpd/lua-bozo.c  Thu Oct 17 02:58:56 2013 +0000
+++ b/libexec/httpd/lua-bozo.c  Thu Oct 17 07:31:31 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lua-bozo.c,v 1.1 2013/10/12 17:24:07 mbalmer Exp $     */
+/*     $NetBSD: lua-bozo.c,v 1.2 2013/10/17 07:31:31 mbalmer Exp $     */
 
 /*
  * Copyright (c) 2013 Marc Balmer <marc%msys.ch@localhost>
@@ -91,6 +91,7 @@
 
        len = luaL_checkinteger(L, -1);
        data = bozomalloc(httpd, len + 1);
+       memset(data, 0, len + 1);
        bozo_read(httpd, STDIN_FILENO, data, len);
        lua_pushstring(L, data);
        free(data);
@@ -406,7 +407,8 @@
                                        if (clen && *clen && atol(clen) > 0) {
                                                length = atol(clen);
                                                content = bozomalloc(httpd,
-                                                   length);
+                                                   length + 1);
+                                               memset(content, 0, length + 1);
                                                bozo_read(httpd, STDIN_FILENO,
                                                    content, length);
                                                lua_decode_query(map->L,



Home | Main Index | Thread Index | Old Index