Date: Sun, 3 Jan 1999 04:46:40 +0100 (CET) From: murduth@ludd.luth.se To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/9281: [PATCH] awk uses junk memory Message-ID: <199901030346.EAA41959@rmstar.campus.luth.se>
next in thread | raw e-mail | index | archive | help
>Number: 9281 >Category: bin >Synopsis: awk asumes memory that is returned from malloc is clean. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jan 2 19:50:00 PST 1999 >Last-Modified: >Originator: Joakim Henriksson >Organization: FreeBSD >Release: FreeBSD-CURRENT >Environment: /usr/src/contrib/awk/awk.y version 1.1.1.1 >Description: When repporting errors (and problably other places i havn't found/looked for) awk puts out garbage due to non null memory from malloc. >How-To-Repeat: cd /etc ; ln -s malloc.conf AJ cd ; cat > test.awk /foo/{ {if (FNR==2) foo = $0} ^D awk -f test.awk >Fix: Apply following patch in /usr/src. *** contrib/awk/awk.y.orig Sun Jan 3 03:54:24 1999 --- contrib/awk/awk.y Sun Jan 3 04:29:59 1999 *************** *** 1091,1096 **** --- 1091,1097 ---- } len = lexptr - scan; emalloc(buf, char *, len+1, "get_src_buf"); + bzero(buf, len + 1); memcpy(buf, scan, len); thisline = buf; lexptr = buf + len; *************** *** 1130,1136 **** newfile = TRUE; if (buf != NULL) free(buf); ! emalloc(buf, char *, len + SLOP, "get_src_buf"); lexptr_begin = buf + SLOP; samefile = TRUE; sourceline = 1; --- 1131,1138 ---- newfile = TRUE; if (buf != NULL) free(buf); ! emalloc(buf, char *, len + SLOP + 1, "get_src_buf"); ! bzero(buf, len + SLOP + 1); lexptr_begin = buf + SLOP; samefile = TRUE; sourceline = 1; >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901030346.EAA41959>