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/ranlib | |
parent | 4234a1a243b834469e3fe6f32ec3de5764c93d16 (diff) |
simple snprintf; tdeval matthieu ok
Diffstat (limited to 'usr.bin/ranlib')
-rw-r--r-- | usr.bin/ranlib/build.c | 6 | ||||
-rw-r--r-- | usr.bin/ranlib/touch.c | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/ranlib/build.c b/usr.bin/ranlib/build.c index 9fb7fa41235..51a942e292a 100644 --- a/usr.bin/ranlib/build.c +++ b/usr.bin/ranlib/build.c @@ -1,4 +1,4 @@ -/* $OpenBSD: build.c,v 1.8 2001/11/19 19:02:15 mpech Exp $ */ +/* $OpenBSD: build.c,v 1.9 2003/04/04 22:12:09 deraadt Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -38,7 +38,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)build.c 5.3 (Berkeley) 3/12/91";*/ -static char rcsid[] = "$OpenBSD: build.c,v 1.8 2001/11/19 19:02:15 mpech Exp $"; +static char rcsid[] = "$OpenBSD: build.c,v 1.9 2003/04/04 22:12:09 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -284,7 +284,7 @@ symobj(mid) /* Put out the ranlib archive file header. */ #define DEFMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) - (void)sprintf(hb, HDR2, RANLIBMAG, 0L, uid, gid, + (void)snprintf(hb, sizeof hb, HDR2, RANLIBMAG, 0L, uid, gid, DEFMODE & ~umask(0), (off_t)ransize, ARFMAG); if (!fwrite(hb, sizeof(struct ar_hdr), 1, fp)) error(tname); diff --git a/usr.bin/ranlib/touch.c b/usr.bin/ranlib/touch.c index 9841039207c..eb181229778 100644 --- a/usr.bin/ranlib/touch.c +++ b/usr.bin/ranlib/touch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: touch.c,v 1.3 1999/09/21 13:15:43 espie Exp $ */ +/* $OpenBSD: touch.c,v 1.4 2003/04/04 22:12:09 deraadt Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -38,7 +38,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)touch.c 5.3 (Berkeley) 3/12/91";*/ -static char rcsid[] = "$OpenBSD: touch.c,v 1.3 1999/09/21 13:15:43 espie Exp $"; +static char rcsid[] = "$OpenBSD: touch.c,v 1.4 2003/04/04 22:12:09 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -84,7 +84,8 @@ settime(afd) size = SARMAG + sizeof(hdr->ar_name); if (lseek(afd, size, SEEK_SET) == (off_t)-1) error(archive); - (void)sprintf(buf, "%-12ld", (long int)time((time_t *)NULL) + RANLIBSKEW); + (void)snprintf(buf, sizeof buf, + "%-12ld", (long int)time((time_t *)NULL) + RANLIBSKEW); if (write(afd, buf, sizeof(hdr->ar_date)) != sizeof(hdr->ar_date)) error(archive); } |