summaryrefslogtreecommitdiffstats
path: root/sbin/savecore
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2012-12-16 22:59:25 +0000
committerpjd <pjd@FreeBSD.org>2012-12-16 22:59:25 +0000
commite18befc88a006695eec98af0b3091ca54c2c7ab8 (patch)
tree69eb7fb326fbd9fdf4d7acac3997e4be47ef28a0 /sbin/savecore
parentf218d978bf22f1f76c4b69454a6b852fb5331225 (diff)
downloadFreeBSD-src-e18befc88a006695eec98af0b3091ca54c2c7ab8.zip
FreeBSD-src-e18befc88a006695eec98af0b3091ca54c2c7ab8.tar.gz
Prefer snprintf() over sprintf().
Obtained from: WHEEL Systems
Diffstat (limited to 'sbin/savecore')
-rw-r--r--sbin/savecore/savecore.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
index a1fe848..26eae53 100644
--- a/sbin/savecore/savecore.c
+++ b/sbin/savecore/savecore.c
@@ -543,7 +543,7 @@ DoFile(const char *savedir, const char *device)
writebounds(bounds + 1);
- sprintf(buf, "info.%d", bounds);
+ snprintf(buf, sizeof(buf), "info.%d", bounds);
/*
* Create or overwrite any existing dump header files.
@@ -556,12 +556,12 @@ DoFile(const char *savedir, const char *device)
}
oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/
if (compress) {
- sprintf(filename, "%s.%d.gz", istextdump ? "textdump.tar" :
- "vmcore", bounds);
+ snprintf(filename, sizeof(filename), "%s.%d.gz",
+ istextdump ? "textdump.tar" : "vmcore", bounds);
fp = zopen(filename, "w");
} else {
- sprintf(filename, "%s.%d", istextdump ? "textdump.tar" :
- "vmcore", bounds);
+ snprintf(filename, sizeof(filename), "%s.%d",
+ istextdump ? "textdump.tar" : "vmcore", bounds);
fp = fopen(filename, "w");
}
if (fp == NULL) {
OpenPOWER on IntegriCloud