aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2012-12-16 22:59:25 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2012-12-16 22:59:25 +0000
commit87c3930b34d8cf1df69367ebcb44cbd0cf32f9ec (patch)
tree69eb7fb326fbd9fdf4d7acac3997e4be47ef28a0 /sbin
parentd464a3641dc70b238335e64ec0fd43423442feba (diff)
downloadsrc-87c3930b34d8cf1df69367ebcb44cbd0cf32f9ec.tar.gz
src-87c3930b34d8cf1df69367ebcb44cbd0cf32f9ec.zip
Prefer snprintf() over sprintf().
Obtained from: WHEEL Systems
Notes
Notes: svn path=/head/; revision=244316
Diffstat (limited to 'sbin')
-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 a1fe8486fcc2..26eae53ceae1 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) {