diff options
author | av <av@cvs.openbsd.org> | 2008-07-23 21:33:33 +0000 |
---|---|---|
committer | av <av@cvs.openbsd.org> | 2008-07-23 21:33:33 +0000 |
commit | 44cec180ef0f1cf49f60f62b98c7d85f26735faf (patch) | |
tree | 108c91c49e010e8c56c0a0acd59a448e23e32618 /usr.bin/cdio/mmc.c | |
parent | f12b9c901d32a155dec7e75845d17831ebb11110 (diff) |
we really need unsigned in arithmetic operations.
comments by fgsch
Diffstat (limited to 'usr.bin/cdio/mmc.c')
-rw-r--r-- | usr.bin/cdio/mmc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/cdio/mmc.c b/usr.bin/cdio/mmc.c index 6089ef7730b..1ed45d8c8c6 100644 --- a/usr.bin/cdio/mmc.c +++ b/usr.bin/cdio/mmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mmc.c,v 1.22 2008/06/30 23:35:39 av Exp $ */ +/* $OpenBSD: mmc.c,v 1.23 2008/07/23 21:33:32 av Exp $ */ /* * Copyright (c) 2006 Michael Coulter <mjc@openbsd.org> @@ -45,7 +45,7 @@ int get_media_capabilities(int *cap) { scsireq_t scr; - char buf[4096]; + u_char buf[4096]; int error; u_int32_t i, dsz; u_int16_t feature; @@ -78,7 +78,7 @@ get_media_capabilities(int *cap) dsz += 4; /* total size of bufer for all features */ i = 8; while (i <= dsz - 4) { - if (dsz - i < 4 + buf[i + 3]) + if (dsz - i < (u_int32_t)buf[i + 3] + 4) break; /* partial feature descriptor */ feature = betoh16(*(u_int16_t *)(buf + i)); |