From 267d54bd4b73d29baa50a320d014f2a4bde4e356 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Thu, 20 Mar 2008 22:16:31 +0000 Subject: [PATCH] * Fix menuconfig.init memory corruption; strstr does not work on file contents unless they are guaranteed to be zero-terminated by some out-of-band means (such as help texts). --- debian/changelog | 3 +++ menuconfig.inc | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0567783..e0f073c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ gfxboot-theme-ubuntu (0.5.11) UNRELEASED; urgency=low * Backport 'split' memory corruption fix from SuSE. + * Fix menuconfig.init memory corruption; strstr does not work on file + contents unless they are guaranteed to be zero-terminated by some + out-of-band means (such as help texts). -- Colin Watson Thu, 20 Mar 2008 22:12:01 +0000 diff --git a/menuconfig.inc b/menuconfig.inc index bd9eff5..a2e0730 100644 --- a/menuconfig.inc +++ b/menuconfig.inc @@ -126,8 +126,10 @@ dup cvp length 0 eq { exit } if % break lines at \r or \n - dup "\x0d" strstr dup 0 ne { 1 sub over exch 0 put } { pop } ifelse - dup "\n" strstr dup 0 ne { 1 sub over exch 0 put } { pop } ifelse + 0 1 2 index length 1 sub { + over over get + dup '\x0d' eq exch '\n' eq or { over exch 0 put exit } { pop } ifelse + } for skipspace getword tolower % keep in sync with common.inc:MenuInit