summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Valchev <pvalchev@cvs.openbsd.org>2003-04-05 01:39:51 +0000
committerPeter Valchev <pvalchev@cvs.openbsd.org>2003-04-05 01:39:51 +0000
commit3388607b5c19719737994f8d27aaa451a7152d39 (patch)
treecdea6b8beea2ddf100f81af9ff58e8a6b4af5830
parent6ef06ef3d19087a7d9962c574e73e4261e8d6ae6 (diff)
snprintf, strlcpy; ok deraadt tdeval tedu krw
-rw-r--r--usr.bin/window/lcmd1.c6
-rw-r--r--usr.bin/window/lcmd2.c6
-rw-r--r--usr.bin/window/startup.c6
-rw-r--r--usr.bin/window/string.c6
-rw-r--r--usr.bin/window/ttzapple.c8
-rw-r--r--usr.bin/window/wwdump.c6
-rw-r--r--usr.bin/window/wwinit.c6
-rw-r--r--usr.bin/window/wwprintf.c6
-rw-r--r--usr.bin/window/wwpty.c6
9 files changed, 28 insertions, 28 deletions
diff --git a/usr.bin/window/lcmd1.c b/usr.bin/window/lcmd1.c
index 0222c1d33ee..4cef48ec12b 100644
--- a/usr.bin/window/lcmd1.c
+++ b/usr.bin/window/lcmd1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lcmd1.c,v 1.6 2001/11/19 19:02:18 mpech Exp $ */
+/* $OpenBSD: lcmd1.c,v 1.7 2003/04/05 01:39:50 pvalchev Exp $ */
/* $NetBSD: lcmd1.c,v 1.6 1996/02/08 20:45:00 mycroft Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)lcmd1.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: lcmd1.c,v 1.6 2001/11/19 19:02:18 mpech Exp $";
+static char rcsid[] = "$OpenBSD: lcmd1.c,v 1.7 2003/04/05 01:39:50 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -330,7 +330,7 @@ struct value *a;
return;
while (a->v_type != V_ERR) {
if (a->v_type == V_NUM) {
- (void) sprintf(buf, "%d", a->v_num);
+ (void) snprintf(buf, sizeof(buf), "%d", a->v_num);
(void) write(w->ww_pty, buf, strlen(buf));
} else
(void) write(w->ww_pty, a->v_str, strlen(a->v_str));
diff --git a/usr.bin/window/lcmd2.c b/usr.bin/window/lcmd2.c
index b131c2e9360..25e6a77c4b2 100644
--- a/usr.bin/window/lcmd2.c
+++ b/usr.bin/window/lcmd2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lcmd2.c,v 1.5 2001/11/19 19:02:18 mpech Exp $ */
+/* $OpenBSD: lcmd2.c,v 1.6 2003/04/05 01:39:50 pvalchev Exp $ */
/* $NetBSD: lcmd2.c,v 1.7 1995/09/29 00:44:04 cgd Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)lcmd2.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: lcmd2.c,v 1.5 2001/11/19 19:02:18 mpech Exp $";
+static char rcsid[] = "$OpenBSD: lcmd2.c,v 1.6 2003/04/05 01:39:50 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -390,7 +390,7 @@ struct value *a;
return;
while (a->v_type != V_ERR) {
if (a->v_type == V_NUM) {
- (void) sprintf(buf, "%d", a->v_num);
+ (void) snprintf(buf, sizeof(buf), "%d", a->v_num);
(void) wwwrite(w, buf, strlen(buf));
} else
(void) wwwrite(w, a->v_str, strlen(a->v_str));
diff --git a/usr.bin/window/startup.c b/usr.bin/window/startup.c
index 58906d4ba88..d4e752221e4 100644
--- a/usr.bin/window/startup.c
+++ b/usr.bin/window/startup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: startup.c,v 1.6 2001/11/19 19:02:18 mpech Exp $ */
+/* $OpenBSD: startup.c,v 1.7 2003/04/05 01:39:50 pvalchev Exp $ */
/* $NetBSD: startup.c,v 1.4 1996/02/08 20:45:04 mycroft Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)startup.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: startup.c,v 1.6 2001/11/19 19:02:18 mpech Exp $";
+static char rcsid[] = "$OpenBSD: startup.c,v 1.7 2003/04/05 01:39:50 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -60,7 +60,7 @@ doconfig()
if ((home = getenv("HOME")) == NULL || *home == '\0')
return -1;
- (void) sprintf(buf, "%.*s/%s",
+ (void) snprintf(buf, sizeof(buf), "%.*s/%s",
(sizeof buf - sizeof runcom) / sizeof (char) - 1,
home, runcom);
return dosource(buf);
diff --git a/usr.bin/window/string.c b/usr.bin/window/string.c
index c70fede0ce8..46bf81a3643 100644
--- a/usr.bin/window/string.c
+++ b/usr.bin/window/string.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: string.c,v 1.5 2001/11/19 19:02:18 mpech Exp $ */
+/* $OpenBSD: string.c,v 1.6 2003/04/05 01:39:50 pvalchev Exp $ */
/* $NetBSD: string.c,v 1.5 1995/09/29 00:44:06 cgd Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)string.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: string.c,v 1.5 2001/11/19 19:02:18 mpech Exp $";
+static char rcsid[] = "$OpenBSD: string.c,v 1.6 2003/04/05 01:39:50 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -90,7 +90,7 @@ int i;
{
char buf[30];
- (void) sprintf(buf, "%d", i);
+ (void) snprintf(buf, sizeof(buf), "%d", i);
return str_cpy(buf);
}
diff --git a/usr.bin/window/ttzapple.c b/usr.bin/window/ttzapple.c
index 468487fdc57..6d3da2a146e 100644
--- a/usr.bin/window/ttzapple.c
+++ b/usr.bin/window/ttzapple.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttzapple.c,v 1.4 2001/11/19 19:02:18 mpech Exp $ */
+/* $OpenBSD: ttzapple.c,v 1.5 2003/04/05 01:39:50 pvalchev Exp $ */
/* $NetBSD: ttzapple.c,v 1.3 1995/09/28 10:34:57 tls Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)ttzapple.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: ttzapple.c,v 1.4 2001/11/19 19:02:18 mpech Exp $";
+static char rcsid[] = "$OpenBSD: ttzapple.c,v 1.5 2003/04/05 01:39:50 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -334,7 +334,7 @@ zz_set_token(t, s, n)
if (zz_debug) {
char buf[100];
zz_setmodes(WWM_REV);
- (void) sprintf(buf, "%02x=", t);
+ (void) snprintf(buf, sizeof(buf), "%02x=", t);
ttputs(buf);
tt.tt_col += 3;
}
@@ -354,7 +354,7 @@ zz_put_token(t, s, n)
if (zz_debug) {
char buf[100];
zz_setmodes(WWM_REV);
- (void) sprintf(buf, "%02x>", t);
+ (void) snprintf(buf, sizeof(buf), "%02x>", t);
ttputs(buf);
tt.tt_col += 3;
}
diff --git a/usr.bin/window/wwdump.c b/usr.bin/window/wwdump.c
index 0c9e8d91474..02713cd8333 100644
--- a/usr.bin/window/wwdump.c
+++ b/usr.bin/window/wwdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wwdump.c,v 1.4 2001/11/19 19:02:18 mpech Exp $ */
+/* $OpenBSD: wwdump.c,v 1.5 2003/04/05 01:39:50 pvalchev Exp $ */
/* $NetBSD: wwdump.c,v 1.5 1995/09/29 00:44:09 cgd Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)wwdump.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: wwdump.c,v 1.4 2001/11/19 19:02:18 mpech Exp $";
+static char rcsid[] = "$OpenBSD: wwdump.c,v 1.5 2003/04/05 01:39:50 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -75,7 +75,7 @@ struct ww *w;
(*tt.tt_clear)();
for (i = w->ww_i.t; i < w->ww_i.b; i++) {
(*tt.tt_move)(i, w->ww_i.l);
- (void) sprintf(buf, "%d", w->ww_nvis[i]);
+ (void) snprintf(buf, sizeof(buf), "%d", w->ww_nvis[i]);
(*tt.tt_write)(buf, strlen(buf));
}
}
diff --git a/usr.bin/window/wwinit.c b/usr.bin/window/wwinit.c
index 66a5545687c..15f442339d9 100644
--- a/usr.bin/window/wwinit.c
+++ b/usr.bin/window/wwinit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wwinit.c,v 1.11 2001/11/19 19:02:18 mpech Exp $ */
+/* $OpenBSD: wwinit.c,v 1.12 2003/04/05 01:39:50 pvalchev Exp $ */
/* $NetBSD: wwinit.c,v 1.11 1996/02/08 21:49:07 mycroft Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)wwinit.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: wwinit.c,v 1.11 2001/11/19 19:02:18 mpech Exp $";
+static char rcsid[] = "$OpenBSD: wwinit.c,v 1.12 2003/04/05 01:39:50 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -311,7 +311,7 @@ wwinit()
for (; *kp; kp++)
;
for (i = 1; i <= j; i++) {
- (void) sprintf(cap, "k%d", i);
+ (void) snprintf(cap, sizeof(cap), "k%d", i);
wwaddcap(cap, &kp);
cap[0] = 'l';
wwaddcap(cap, &kp);
diff --git a/usr.bin/window/wwprintf.c b/usr.bin/window/wwprintf.c
index 4329cbf08ca..57c73fcc0e8 100644
--- a/usr.bin/window/wwprintf.c
+++ b/usr.bin/window/wwprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wwprintf.c,v 1.4 2002/10/04 16:39:26 mickey Exp $ */
+/* $OpenBSD: wwprintf.c,v 1.5 2003/04/05 01:39:50 pvalchev Exp $ */
/* $NetBSD: wwprintf.c,v 1.3 1995/09/28 10:35:44 tls Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)wwprintf.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: wwprintf.c,v 1.4 2002/10/04 16:39:26 mickey Exp $";
+static char rcsid[] = "$OpenBSD: wwprintf.c,v 1.5 2003/04/05 01:39:50 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -55,6 +55,6 @@ wwprintf(struct ww *w, char *fmt, ...)
va_start(ap, fmt);
/* buffer can overflow */
- (void) wwwrite(w, buf, vsprintf(buf, fmt, ap));
+ (void) wwwrite(w, buf, vsnprintf(buf, sizeof(buf), fmt, ap));
va_end(ap);
}
diff --git a/usr.bin/window/wwpty.c b/usr.bin/window/wwpty.c
index 500c2b1129b..8be9150aa54 100644
--- a/usr.bin/window/wwpty.c
+++ b/usr.bin/window/wwpty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wwpty.c,v 1.5 2001/11/19 19:02:18 mpech Exp $ */
+/* $OpenBSD: wwpty.c,v 1.6 2003/04/05 01:39:50 pvalchev Exp $ */
/* $NetBSD: wwpty.c,v 1.3 1995/09/28 10:35:45 tls Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)wwpty.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: wwpty.c,v 1.5 2001/11/19 19:02:18 mpech Exp $";
+static char rcsid[] = "$OpenBSD: wwpty.c,v 1.6 2003/04/05 01:39:50 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -63,7 +63,7 @@ struct ww *w;
#define _PQRS 8
#define _0_9 9
- (void) strcpy(w->ww_ttyname, PTY);
+ (void) strlcpy(w->ww_ttyname, PTY, sizeof(w->ww_ttyname));
for (c = 'p'; c <= 'u'; c++) {
w->ww_ttyname[_PT] = 'p';
w->ww_ttyname[_PQRS] = c;