summaryrefslogtreecommitdiffstats
path: root/sbin/dump/dumprmt.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1997-01-07 20:48:24 +0000
committerimp <imp@FreeBSD.org>1997-01-07 20:48:24 +0000
commiteba6461a0360d1811fb9e58dbfe4ab0e3658ccbd (patch)
treee02e65c458a9d952876a5e3db19fabbe45f88b96 /sbin/dump/dumprmt.c
parentc2735e9515ef283947cf5b490018fd18b0b1a35f (diff)
downloadFreeBSD-src-eba6461a0360d1811fb9e58dbfe4ab0e3658ccbd.zip
FreeBSD-src-eba6461a0360d1811fb9e58dbfe4ab0e3658ccbd.tar.gz
Fix many buffer overflows, correct usage of strcat and implement
$TAPE. Inspired by OpenBSD's work in this area. Reviewed by: Peter Wemm, Guido van Rooij and Jordan Hubbard. Obtained from: OpenBSD
Diffstat (limited to 'sbin/dump/dumprmt.c')
-rw-r--r--sbin/dump/dumprmt.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/dump/dumprmt.c b/sbin/dump/dumprmt.c
index d7d59a4..08aa485 100644
--- a/sbin/dump/dumprmt.c
+++ b/sbin/dump/dumprmt.c
@@ -219,7 +219,7 @@ rmtopen(tape, mode)
{
char buf[256];
- (void)sprintf(buf, "O%s\n%d\n", tape, mode);
+ (void)snprintf(buf, sizeof (buf), "O%.226s\n%d\n", tape, mode);
rmtstate = TS_OPEN;
return (rmtcall(tape, buf));
}
@@ -243,7 +243,7 @@ rmtread(buf, count)
int n, i, cc;
extern errno;
- (void)sprintf(line, "R%d\n", count);
+ (void)snprintf(line, sizeof (line), "R%d\n", count);
n = rmtcall("read", line);
if (n < 0) {
errno = n;
@@ -265,7 +265,7 @@ rmtwrite(buf, count)
{
char line[30];
- (void)sprintf(line, "W%d\n", count);
+ (void)snprintf(line, sizeof (line), "W%d\n", count);
write(rmtape, line, strlen(line));
write(rmtape, buf, count);
return (rmtreply("write"));
@@ -277,7 +277,7 @@ rmtwrite0(count)
{
char line[30];
- (void)sprintf(line, "W%d\n", count);
+ (void)snprintf(line, sizeof (line), "W%d\n", count);
write(rmtape, line, strlen(line));
}
@@ -303,7 +303,7 @@ rmtseek(offset, pos)
{
char line[80];
- (void)sprintf(line, "L%d\n%d\n", offset, pos);
+ (void)snprintf(line, sizeof (line), "L%d\n%d\n", offset, pos);
return (rmtcall("seek", line));
}
@@ -331,7 +331,7 @@ rmtioctl(cmd, count)
if (count < 0)
return (-1);
- (void)sprintf(buf, "I%d\n%d\n", cmd, count);
+ (void)snprintf(buf, sizeof (buf), "I%d\n%d\n", cmd, count);
return (rmtcall("ioctl", buf));
}
OpenPOWER on IntegriCloud