Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/fstat use bounded string op



details:   https://anonhg.NetBSD.org/src/rev/da99a7ed3e61
branches:  trunk
changeset: 549507:da99a7ed3e61
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Jul 15 05:56:55 2003 +0000

description:
use bounded string op

diffstat:

 usr.bin/fstat/fstat.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (64 lines):

diff -r 0c4f6972b107 -r da99a7ed3e61 usr.bin/fstat/fstat.c
--- a/usr.bin/fstat/fstat.c     Tue Jul 15 05:52:48 2003 +0000
+++ b/usr.bin/fstat/fstat.c     Tue Jul 15 05:56:55 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fstat.c,v 1.62 2003/04/02 10:39:46 fvdl Exp $  */
+/*     $NetBSD: fstat.c,v 1.63 2003/07/15 05:56:55 itojun Exp $        */
 
 /*-
  * Copyright (c) 1988, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)fstat.c    8.3 (Berkeley) 5/2/95";
 #else
-__RCSID("$NetBSD: fstat.c,v 1.62 2003/04/02 10:39:46 fvdl Exp $");
+__RCSID("$NetBSD: fstat.c,v 1.63 2003/07/15 05:56:55 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -528,9 +528,9 @@
        }
        rw[0] = '\0';
        if (flag & FREAD)
-               strcat(rw, "r");
+               strlcat(rw, "r", sizeof(rw));
        if (flag & FWRITE)
-               strcat(rw, "w");
+               strlcat(rw, "w", sizeof(rw));
        printf(" %-2s", rw);
        if (filename && !fsflg)
                printf("  %s", filename);
@@ -867,14 +867,14 @@
                                goto bad;
                        }
                        printf(" %lx", (long)in6pcb.in6p_ppcb);
-                       sprintf(xaddrbuf, "[%s]",
+                       snprintf(xaddrbuf, sizeof(xaddrbuf), "[%s]",
                            inet6_addrstr(&in6pcb.in6p_laddr));
                        printf(" %s:%d",
                            IN6_IS_ADDR_UNSPECIFIED(&in6pcb.in6p_laddr) ? "*" :
                            xaddrbuf,
                            ntohs(in6pcb.in6p_lport));
                        if (in6pcb.in6p_fport) {
-                               sprintf(xaddrbuf, "[%s]", 
+                               snprintf(xaddrbuf, sizeof(xaddrbuf), "[%s]", 
                                    inet6_addrstr(&in6pcb.in6p_faddr));
                                printf(" <-> %s:%d",
                                    IN6_IS_ADDR_UNSPECIFIED(&in6pcb.in6p_faddr) ? "*" :
@@ -890,14 +890,14 @@
                                goto bad;
                        }
                        printf(" %lx", (long)so.so_pcb);
-                       sprintf(xaddrbuf, "[%s]", 
+                       snprintf(xaddrbuf, sizeof(xaddrbuf), "[%s]", 
                            inet6_addrstr(&in6pcb.in6p_laddr));
                        printf(" %s:%d",
                            IN6_IS_ADDR_UNSPECIFIED(&in6pcb.in6p_laddr) ? "*" :
                            xaddrbuf,
                            ntohs(in6pcb.in6p_lport));
                        if (in6pcb.in6p_fport) {
-                               sprintf(xaddrbuf, "[%s]", 
+                               snprintf(xaddrbuf, sizeof(xaddrbuf), "[%s]", 
                                    inet6_addrstr(&in6pcb.in6p_faddr));
                                printf(" <-> %s:%d",
                                    IN6_IS_ADDR_UNSPECIFIED(&in6pcb.in6p_faddr) ? "*" :



Home | Main Index | Thread Index | Old Index