diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-11-25 07:34:18 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-11-25 07:34:18 +0000 |
commit | c427d9b1c8daba66d96a9a95c1889f0c58b42b14 (patch) | |
tree | efbd61821ca9a2e5c622f1bd8843f36592565d95 /usr.bin | |
parent | 87bbbe7b43952169a3ba733b76986d19bb70156c (diff) |
snprintf makes me happy
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mg/buffer.c | 5 | ||||
-rw-r--r-- | usr.bin/mg/grep.c | 10 | ||||
-rw-r--r-- | usr.bin/mg/help.c | 4 |
3 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c index a6879867e45..22898104ee5 100644 --- a/usr.bin/mg/buffer.c +++ b/usr.bin/mg/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.16 2001/08/18 21:36:11 deraadt Exp $ */ +/* $OpenBSD: buffer.c,v 1.17 2001/11/25 07:34:17 deraadt Exp $ */ /* * Buffer handling. @@ -303,7 +303,8 @@ anycb(f) for (bp = bheadp; bp != NULL; bp = bp->b_bufp) { if (*(bp->b_fname) != '\0' && (bp->b_flag & BFCHG) != 0) { - sprintf(prompt, "Save file %s", bp->b_fname); + snprintf(prompt, sizeof prompt, "Save file %s", + bp->b_fname); if ((f == TRUE || (save = eyorn(prompt)) == TRUE) && buffsave(bp) == TRUE) { bp->b_flag &= ~BFCHG; diff --git a/usr.bin/mg/grep.c b/usr.bin/mg/grep.c index b4310cd2f2d..56e1019c23b 100644 --- a/usr.bin/mg/grep.c +++ b/usr.bin/mg/grep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grep.c,v 1.1 2001/05/24 10:58:34 art Exp $ */ +/* $OpenBSD: grep.c,v 1.2 2001/11/25 07:34:17 deraadt Exp $ */ /* * Copyright (c) 2001 Artur Grabowski <art@openbsd.org>. All rights reserved. * @@ -77,11 +77,11 @@ grep(int f, int n) BUFFER *bp; MGWIN *wp; - strcpy(prompt, "grep -n "); + strlcpy(prompt, "grep -n ", sizeof prompt); if (eread("Run grep: ", prompt, NFILEN, EFDEF|EFNEW|EFCR) == ABORT) return ABORT; - sprintf(command, "%s /dev/null", prompt); + snprintf(command, sizeof command, "%s /dev/null", prompt); if ((bp = compile_mode("*grep*", command)) == NULL) return FALSE; @@ -104,7 +104,7 @@ compile(int f, int n) if (eread("Compile command: ", prompt, NFILEN, EFDEF|EFNEW|EFCR) == ABORT) return ABORT; - sprintf(command, "%s 2>&1", prompt); + snprintf(command, sizeof command, "%s 2>&1", prompt); if ((bp = compile_mode("*compile*", command)) == NULL) return FALSE; @@ -127,7 +127,7 @@ gid(int f, int n) if (eread("Run gid (with args): ", prompt, NFILEN, EFNEW|EFCR) == ABORT) return ABORT; - sprintf(command, "gid %s", prompt); + snprintf(command, sizeof command, "gid %s", prompt); if ((bp = compile_mode("*gid*", command)) == NULL) return FALSE; diff --git a/usr.bin/mg/help.c b/usr.bin/mg/help.c index 9f320079dd2..c5432fbfa63 100644 --- a/usr.bin/mg/help.c +++ b/usr.bin/mg/help.c @@ -1,4 +1,4 @@ -/* $OpenBSD: help.c,v 1.14 2001/05/24 09:47:34 art Exp $ */ +/* $OpenBSD: help.c,v 1.15 2001/11/25 07:34:17 deraadt Exp $ */ /* * Help functions for Mg 2 @@ -137,7 +137,7 @@ showall(BUFFER *bp, KEYMAP *map, char *prefix) if (fun == rescan || fun == selfinsert) continue; keyname(buf, sizeof(buf), c); - sprintf(key, "%s%s ", prefix, buf); + snprintf(key, sizeof key, "%s%s ", prefix, buf); if (fun == NULL) { if (showall(bp, newmap, key) == FALSE) return FALSE; |