From 6bf964e1a60fa5bb711b214d387c6f288b402685 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Fri, 20 Jun 2003 08:16:02 +0000 Subject: [PATCH] Don't do sprintf(). p4raw-id: //depot/perl@19833 --- malloc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/malloc.c b/malloc.c index 0e6e642..b080444 100644 --- a/malloc.c +++ b/malloc.c @@ -1269,8 +1269,6 @@ botch(char *diag, char *s, char *file, int line) goto do_write; else { dTHX; - char linebuf[10]; - if (PerlIO_printf(PerlIO_stderr(), "assertion botched (%s?): %s%s %s:%d\n", diag, s, file, line) != 0) { @@ -1282,8 +1280,16 @@ botch(char *diag, char *s, char *file, int line) write2(" ("); write2(file); write2(":"); - sprintf(linebuf, "%d", line); - write2(linebuf); + { + char linebuf[10]; + char *s = linebuf + sizeof(linebuf) - 1; + int n = line; + *s = 0; + do { + *--s = '0' + (n % 10); + } while (n /= 10); + write2(s); + } write2(")\n"); } PerlProc_abort(); -- 1.8.3.1