summaryrefslogtreecommitdiffstats
path: root/sbin/dump
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/dump')
-rw-r--r--sbin/dump/dump.h5
-rw-r--r--sbin/dump/itime.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/sbin/dump/dump.h b/sbin/dump/dump.h
index efef7f7..2a65865 100644
--- a/sbin/dump/dump.h
+++ b/sbin/dump/dump.h
@@ -171,9 +171,10 @@ void putdumptime(void);
if (ddatev != NULL) \
for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
-#define DUMPOUTFMT "%-32s %d %s" /* for printf */
+#define DUMPFMTLEN 53 /* max device pathname length */
+#define DUMPOUTFMT "%-*s %d %s" /* for printf */
/* name, level, ctime(date) */
-#define DUMPINFMT "%32s %d %[^\n]\n" /* inverse for scanf */
+#define DUMPINFMT "%s %d %[^\n]\n" /* inverse for scanf */
void sig(int signo);
diff --git a/sbin/dump/itime.c b/sbin/dump/itime.c
index f327188..909b8ab 100644
--- a/sbin/dump/itime.c
+++ b/sbin/dump/itime.c
@@ -222,7 +222,10 @@ static void
dumprecout(FILE *file, const struct dumpdates *what)
{
- if (fprintf(file, DUMPOUTFMT, what->dd_name,
+ if (strlen(what->dd_name) > DUMPFMTLEN)
+ quit("Name '%s' exceeds DUMPFMTLEN (%d) bytes\n",
+ what->dd_name, DUMPFMTLEN);
+ if (fprintf(file, DUMPOUTFMT, DUMPFMTLEN, what->dd_name,
what->dd_level, ctime(&what->dd_ddate)) < 0)
quit("%s: %s\n", dumpdates, strerror(errno));
}
OpenPOWER on IntegriCloud