Merge lp:~tjvries/ubuntu/natty/mawk/fix-for-955791 into lp:ubuntu/natty/mawk

Proposed by Tom de Vries on 2012-03-17
Status: Merged
Merge reported by: Colin Watson
Merged at revision: not available
Proposed branch: lp:~tjvries/ubuntu/natty/mawk/fix-for-955791
Merge into: lp:ubuntu/natty/mawk
Diff against target: 26 lines (+7/-1)
2 files modified
debian/changelog (+6/-0)
fin.c (+1/-1)
To merge this branch: bzr merge lp:~tjvries/ubuntu/natty/mawk/fix-for-955791
Reviewer Review Type Date Requested Status
Bryce Harrington Approve on 2012-03-23
Ubuntu branches 2012-03-17 Pending
Review via email: mp+98069@code.launchpad.net

Description of the Change

to reproduce/test:
1. download CAT and guts.awk from https://bugs.launchpad.net/ubuntu/+source/mawk/+bug/955791
2. run 'cat CAT | valgrind mawk -f guts.awk'
   run it in an empty directory because it creates files.

The problem is that memcpy is called from FINgets with src and dest arguments that overlap, which is not allowed.

The fix is to replace the memcpy with memmove, where overlap is allowed.

To post a comment you must log in.
Bryce Harrington (bryce) wrote :

Looks good, and looks like we ship the same version going back to lucid, so I packaged up and uploaded the fix for all releases.

review: Approve
Bryce Harrington (bryce) wrote :

Please set status to Merged.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2010-01-12 00:02:00 +0000
3+++ debian/changelog 2012-03-17 20:25:21 +0000
4@@ -1,3 +1,9 @@
5+mawk (1.3.3-15ubuntu3) natty; urgency=low
6+
7+ * Replace memcpy by memmove in FINgets; LP: #955791.
8+
9+ -- Tom de Vries <tjvries@xs4all.nl> Sat, 17 Mar 2012 21:04:54 +0100
10+
11 mawk (1.3.3-15ubuntu2) lucid; urgency=low
12
13 * Compute md5sums; Debian #507315.
14
15=== modified file 'fin.c'
16--- fin.c 2003-05-30 15:24:50 +0000
17+++ fin.c 2012-03-17 20:25:21 +0000
18@@ -326,7 +326,7 @@
19 /* move a partial line to front of buffer and try again */
20 unsigned rr ;
21
22- p = (char *) memcpy(fin->buff, p, r = strlen(p)) ;
23+ p = (char *) memmove(fin->buff, p, r = strlen(p)) ;
24 q = p+r ; rr = fin->nbuffs*BUFFSZ - r ;
25
26 if ((r = fillbuff(fin->fd, q, rr)) < rr)

Subscribers

People subscribed via source and target branches