fix parsing of some informational CIS tuples: correct length and handle

the case correctly where a string is terminated with 0x00 0xff
This commit is contained in:
drochner 2005-09-08 15:02:48 +00:00
parent 241cff4694
commit 1797f37c06
1 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cardbus.c,v 1.64 2005/08/26 11:01:42 drochner Exp $ */
/* $NetBSD: cardbus.c,v 1.65 2005/09/08 15:02:48 drochner Exp $ */
/*
* Copyright (c) 1997, 1998, 1999 and 2000
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.64 2005/08/26 11:01:42 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.65 2005/09/08 15:02:48 drochner Exp $");
#include "opt_cardbus.h"
@ -291,7 +291,7 @@ parse_tuple(u_int8_t *tuple, int len, void *data)
switch (tuple[0]) {
case PCMCIA_CISTPL_MANFID:
if (tuple[1] != 5) {
if (tuple[1] != 4) {
DPRINTF(("%s: wrong length manufacturer id (%d)\n",
__func__, tuple[1]));
break;
@ -306,12 +306,13 @@ parse_tuple(u_int8_t *tuple, int len, void *data)
p = cis->cis1_info_buf + 2;
while (i <
sizeof(cis->cis1_info) / sizeof(cis->cis1_info[0])) {
if (p >= cis->cis1_info_buf + tuple[1] || *p == '\xff')
break;
cis->cis1_info[i++] = p;
while (*p != '\0' && *p != '\xff')
p++;
if (*p == '\xff')
break;
p++;
if (*p == '\0')
p++;
}
break;