diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-11-01 05:46:21 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-11-01 05:46:21 +0000 |
commit | a717488db5cb5e337f2ff1357e6b6e04617217a1 (patch) | |
tree | 5f4c1f85eaf943e338d9f52b8503f3e1aaf16947 /bin/dd | |
parent | cdef4184fee93d42074835e5654af3674da38628 (diff) |
Fix range checking for in.dbsz and out.dbsz.
Add range checking for cbsz.
Change type in format string to %zd and cast SSIZE_MAX to ssize_t.
Fixes PR 5278 submitted by malaler at gmail dot com.
OK otto@ and millert@.
Diffstat (limited to 'bin/dd')
-rw-r--r-- | bin/dd/args.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/dd/args.c b/bin/dd/args.c index e12ef7efddd..3aef61e8735 100644 --- a/bin/dd/args.c +++ b/bin/dd/args.c @@ -1,4 +1,4 @@ -/* $OpenBSD: args.c,v 1.16 2006/03/22 18:08:04 dhill Exp $ */ +/* $OpenBSD: args.c,v 1.17 2006/11/01 05:46:20 ray Exp $ */ /* $NetBSD: args.c,v 1.7 1996/03/01 01:18:58 jtc Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: args.c,v 1.16 2006/03/22 18:08:04 dhill Exp $"; +static char rcsid[] = "$OpenBSD: args.c,v 1.17 2006/11/01 05:46:20 ray Exp $"; #endif #endif /* not lint */ @@ -171,8 +171,9 @@ jcl(char **argv) * Read and write take size_t's as arguments. Lseek, however, * takes an off_t (quad). */ - if (in.dbsz > SIZE_T_MAX || out.dbsz > SIZE_T_MAX) - errx(1, "buffer sizes cannot be greater than %u", SIZE_T_MAX); + if (cbsz > SSIZE_MAX || in.dbsz > SSIZE_MAX || out.dbsz > SSIZE_MAX) + errx(1, "buffer sizes cannot be greater than %zd", + (ssize_t)SSIZE_MAX); if (in.offset > QUAD_MAX / in.dbsz || out.offset > QUAD_MAX / out.dbsz) errx(1, "seek offsets cannot be larger than %qd", QUAD_MAX); } |