diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-06-23 22:40:56 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-06-23 22:40:56 +0000 |
commit | 30cb72a00b8cc59895c391cad0f8e31611611ec4 (patch) | |
tree | 3e2f67dd80af3489363cf0596b740c6533994e40 /sbin | |
parent | 325437057bbda9490b174c8fc6dc8f0e14a8f145 (diff) |
Fix snprintf return value usage.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/restore/dirs.c | 6 | ||||
-rw-r--r-- | sbin/restore/interactive.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c index 7f6eec0ac6c..2218bfcf084 100644 --- a/sbin/restore/dirs.c +++ b/sbin/restore/dirs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dirs.c,v 1.15 1998/02/17 00:07:51 millert Exp $ */ +/* $OpenBSD: dirs.c,v 1.16 1998/06/23 22:40:30 millert Exp $ */ /* $NetBSD: dirs.c,v 1.26 1997/07/01 05:37:49 lukem Exp $ */ /* @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = "@(#)dirs.c 8.5 (Berkeley) 8/31/94"; #else -static char rcsid[] = "$OpenBSD: dirs.c,v 1.15 1998/02/17 00:07:51 millert Exp $"; +static char rcsid[] = "$OpenBSD: dirs.c,v 1.16 1998/06/23 22:40:30 millert Exp $"; #endif #endif /* not lint */ @@ -257,6 +257,8 @@ treescan(pname, ino, todo) * skipping over "." and ".." */ namelen = snprintf(locname, sizeof(locname), "%s/", pname); + if (namelen >= sizeof(locname)) + namelen = sizeof(locname) - 1; rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt); dp = rst_readdir(dirp); /* "." */ if (dp != NULL && strcmp(dp->d_name, ".") == 0) diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c index f37c0d6eccb..b0050e5185d 100644 --- a/sbin/restore/interactive.c +++ b/sbin/restore/interactive.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interactive.c,v 1.6 1998/01/31 23:08:49 millert Exp $ */ +/* $OpenBSD: interactive.c,v 1.7 1998/06/23 22:40:31 millert Exp $ */ /* $NetBSD: interactive.c,v 1.10 1997/03/19 08:42:52 lukem Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)interactive.c 8.3 (Berkeley) 9/13/94"; #else -static char rcsid[] = "$OpenBSD: interactive.c,v 1.6 1998/01/31 23:08:49 millert Exp $"; +static char rcsid[] = "$OpenBSD: interactive.c,v 1.7 1998/06/23 22:40:31 millert Exp $"; #endif #endif /* not lint */ @@ -537,6 +537,8 @@ printlist(name, basename) entries = 0; listp = list; namelen = snprintf(locname, sizeof(locname), "%s/", name); + if (namelen >= sizeof(locname)) + namelen = sizeof(locname) - 1; while ((dp = rst_readdir(dirp))) { if (dp == NULL) break; |