From fa3e22b8cc4d5ffff4f636d1c002ad14af247d35 Mon Sep 17 00:00:00 2001 From: av Date: Wed, 23 Jul 2008 21:33:32 +0000 Subject: [PATCH] we really need unsigned in arithmetic operations. comments by fgsch --- usr.bin/cdio/cdio.c | 4 ++-- usr.bin/cdio/mmc.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/usr.bin/cdio/cdio.c b/usr.bin/cdio/cdio.c index 2691f97bb0d..481bd6720a1 100644 --- a/usr.bin/cdio/cdio.c +++ b/usr.bin/cdio/cdio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cdio.c,v 1.63 2008/06/30 23:35:39 av Exp $ */ +/* $OpenBSD: cdio.c,v 1.64 2008/07/23 21:33:32 av Exp $ */ /* Copyright (c) 1995 Serge V. Vakulenko * All rights reserved. @@ -1516,7 +1516,7 @@ parse(char *buf, int *cmd) { struct cmdtab *c; char *p; - int len; + size_t len; for (p=buf; isspace(*p); p++) continue; 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 @@ -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)); -- 2.20.1