diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-04-04 22:12:10 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-04-04 22:12:10 +0000 |
commit | 134bd7639be3dadd5b247840fbbb7e56bd7e7513 (patch) | |
tree | 72eb86f76fe94e00a4a06962be507ca2ccd20f82 /usr.bin/ar/archive.c | |
parent | 4234a1a243b834469e3fe6f32ec3de5764c93d16 (diff) |
simple snprintf; tdeval matthieu ok
Diffstat (limited to 'usr.bin/ar/archive.c')
-rw-r--r-- | usr.bin/ar/archive.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/ar/archive.c b/usr.bin/ar/archive.c index 9aeda12f0ca..6043df2f074 100644 --- a/usr.bin/ar/archive.c +++ b/usr.bin/ar/archive.c @@ -1,4 +1,4 @@ -/* $OpenBSD: archive.c,v 1.7 2002/12/14 18:14:35 millert Exp $ */ +/* $OpenBSD: archive.c,v 1.8 2003/04/04 22:12:09 deraadt Exp $ */ /* $NetBSD: archive.c,v 1.7 1995/03/26 03:27:46 glass Exp $ */ /*- @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)archive.c 8.3 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: archive.c,v 1.7 2002/12/14 18:14:35 millert Exp $"; +static char rcsid[] = "$OpenBSD: archive.c,v 1.8 2003/04/04 22:12:09 deraadt Exp $"; #endif #endif /* not lint */ @@ -246,16 +246,19 @@ put_arobj(cfp, sb) name, OLDARMAXNAME, name); (void)fflush(stderr); } - (void)sprintf(hb, HDR3, name, (long int)sb->st_mtimespec.tv_sec, + (void)snprintf(hb, sizeof hb, + HDR3, name, (long int)sb->st_mtimespec.tv_sec, uid, gid, sb->st_mode, sb->st_size, ARFMAG); lname = 0; } else if (lname > sizeof(hdr->ar_name) || strchr(name, ' ')) - (void)sprintf(hb, HDR1, AR_EFMT1, lname, + (void)snprintf(hb, sizeof hb, + HDR1, AR_EFMT1, lname, (long int)sb->st_mtimespec.tv_sec, uid, gid, sb->st_mode, sb->st_size + lname, ARFMAG); else { lname = 0; - (void)sprintf(hb, HDR2, name, (long int)sb->st_mtimespec.tv_sec, + (void)snprintf(hb, sizeof hb, + HDR2, name, (long int)sb->st_mtimespec.tv_sec, uid, gid, sb->st_mode, sb->st_size, ARFMAG); } size = sb->st_size; |