Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/vi fix format string bugs.



details:   https://anonhg.NetBSD.org/src/rev/5c712c17583c
branches:  trunk
changeset: 516139:5c712c17583c
user:      yamt <yamt%NetBSD.org@localhost>
date:      Wed Oct 17 07:38:48 2001 +0000

description:
fix format string bugs.
pointed by Tomoaki IMAMURA in PR/14271.

diffstat:

 usr.bin/vi/common/exf.c   |  6 +++---
 usr.bin/vi/common/msg.c   |  9 ++++++---
 usr.bin/vi/ex/ex_cscope.c |  8 ++++----
 3 files changed, 13 insertions(+), 10 deletions(-)

diffs (99 lines):

diff -r da0202b1f3b0 -r 5c712c17583c usr.bin/vi/common/exf.c
--- a/usr.bin/vi/common/exf.c   Wed Oct 17 06:28:16 2001 +0000
+++ b/usr.bin/vi/common/exf.c   Wed Oct 17 07:38:48 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exf.c,v 1.4 2001/08/17 21:33:46 aymeric Exp $  */
+/*     $NetBSD: exf.c,v 1.5 2001/10/17 07:38:48 yamt Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993, 1994
@@ -860,7 +860,7 @@
         * Note that this code is harmless if you're using libc 4.6.x.
         */
        if (LF_ISSET(FS_APPEND) && lseek(fd, (off_t)0, SEEK_END) < 0) {
-               msgq(sp, M_SYSERR, name);
+               msgq(sp, M_SYSERR, "%s", name);
                return (1);
        }
 #endif
@@ -977,7 +977,7 @@
                        *--s = '.';
                }
        }
-       msgq(sp, M_INFO, s);
+       msgq(sp, M_INFO, "%s", s);
        if (nf)
                FREE_SPACE(sp, p, 0);
        return (0);
diff -r da0202b1f3b0 -r 5c712c17583c usr.bin/vi/common/msg.c
--- a/usr.bin/vi/common/msg.c   Wed Oct 17 06:28:16 2001 +0000
+++ b/usr.bin/vi/common/msg.c   Wed Oct 17 07:38:48 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg.c,v 1.6 2001/05/01 16:46:11 aymeric Exp $  */
+/*     $NetBSD: msg.c,v 1.7 2001/10/17 07:38:48 yamt Exp $     */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -48,7 +48,7 @@
  */
 void
 #ifdef __STDC__
-msgq(SCR *sp, mtype_t mt, const char *fmt, ...)
+msgq(SCR *sp, mtype_t mt, const char *fmt0, ...)
 #else
 msgq(sp, mt, fmt, va_alist)
        SCR *sp;
@@ -72,6 +72,9 @@
        char *rbp, *s_rbp;
        size_t cnt1, cnt2, soff;
 #endif
+#ifdef __STDC__
+       const char *fmt = fmt0;
+#endif
        static int reenter;             /* STATIC: Re-entrancy check. */
        GS *gp;
        size_t blen, len, mlen, nlen;
@@ -283,7 +286,7 @@
 #endif
        /* Format the arguments into the string. */
 #ifdef __STDC__
-        va_start(ap, fmt);
+        va_start(ap, fmt0);
 #else
         va_start(ap);
 #endif
diff -r da0202b1f3b0 -r 5c712c17583c usr.bin/vi/ex/ex_cscope.c
--- a/usr.bin/vi/ex/ex_cscope.c Wed Oct 17 06:28:16 2001 +0000
+++ b/usr.bin/vi/ex/ex_cscope.c Wed Oct 17 07:38:48 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ex_cscope.c,v 1.4 2001/05/02 21:15:19 windsor Exp $    */
+/*     $NetBSD: ex_cscope.c,v 1.5 2001/10/17 07:38:49 yamt Exp $       */
 
 /*-
  * Copyright (c) 1994, 1996
@@ -234,14 +234,14 @@
         * name regardless so that we can use it as a base for searches.
         */
        if (stat(dname, &sb)) {
-               msgq(sp, M_SYSERR, dname);
+               msgq(sp, M_SYSERR, "%s", dname);
                return (1);
        }
        if (S_ISDIR(sb.st_mode)) {
                (void)snprintf(path, sizeof(path),
                    "%s/%s", dname, CSCOPE_DBFILE);
                if (stat(path, &sb)) {
-                       msgq(sp, M_SYSERR, path);
+                       msgq(sp, M_SYSERR, "%s", path);
                        return (1);
                }
                dbname = CSCOPE_DBFILE;
@@ -764,7 +764,7 @@
 
 io_err:        if (feof(csc->from_fp))
                errno = EIO;
-       msgq_str(sp, M_SYSERR, "%s", csc->dname);
+       msgq_str(sp, M_SYSERR, csc->dname, "%s");
        terminate(sp, csc, 0);
        return (1);
 }



Home | Main Index | Thread Index | Old Index