Source-Changes-HG archive

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

[src/trunk]: src/dist/nawk correctly handle 'printf "%c", 0' - previously, it...



details:   https://anonhg.NetBSD.org/src/rev/e290b7ac556d
branches:  trunk
changeset: 533308:e290b7ac556d
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Thu Jun 27 08:52:27 2002 +0000

description:
correctly handle 'printf "%c", 0' - previously, it accessed random
memory and segv'd under some circumstances (e.g. when running
sys/arch/walnut/compile/mkimg.sh rev. 1.2 script)

diffstat:

 dist/nawk/run.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (16 lines):

diff -r e6ff6bc2fc2e -r e290b7ac556d dist/nawk/run.c
--- a/dist/nawk/run.c   Thu Jun 27 08:45:25 2002 +0000
+++ b/dist/nawk/run.c   Thu Jun 27 08:52:27 2002 +0000
@@ -901,8 +901,10 @@
                        if (isnum(x)) {
                                if (getfval(x))
                                        sprintf(p, fmt, (int) getfval(x));
-                               else
-                                       *p++ = '\0';
+                               else {
+                                       *p = '\0';
+                                       *++p = '\0';
+                               }
                        } else
                                sprintf(p, fmt, getsval(x)[0]);
                        break;



Home | Main Index | Thread Index | Old Index