Module Name: src
Committed By: dholland
Date: Sun Mar 23 05:07:59 UTC 2014
Modified Files:
src/bin/sh: histedit.c
Log Message:
don't use sprintf
To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/bin/sh/histedit.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/sh/histedit.c
diff -u src/bin/sh/histedit.c:1.45 src/bin/sh/histedit.c:1.46
--- src/bin/sh/histedit.c:1.45 Tue Mar 20 18:42:29 2012
+++ src/bin/sh/histedit.c Sun Mar 23 05:07:59 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: histedit.c,v 1.45 2012/03/20 18:42:29 matt Exp $ */
+/* $NetBSD: histedit.c,v 1.46 2014/03/23 05:07:59 dholland Exp $ */
/*-
* Copyright (c) 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: histedit.c,v 1.45 2012/03/20 18:42:29 matt Exp $");
+__RCSID("$NetBSD: histedit.c,v 1.46 2014/03/23 05:07:59 dholland Exp $");
#endif
#endif /* not lint */
@@ -432,10 +432,12 @@ histcmd(int argc, char **argv)
}
if (editor) {
char *editcmd;
+ size_t cmdlen;
fclose(efp);
- editcmd = stalloc(strlen(editor) + strlen(editfile) + 2);
- sprintf(editcmd, "%s %s", editor, editfile);
+ cmdlen = strlen(editor) + strlen(editfile) + 2;
+ editcmd = stalloc(cmdlen);
+ snprintf(editcmd, cmdlen, "%s %s", editor, editfile);
evalstring(editcmd, 0); /* XXX - should use no JC command */
INTON;
readcmdfile(editfile); /* XXX - should read back - quick tst */