Skip to contentSkip to conversation

sscanf()/vsscanf() isn't able to handle Hex digits

DISCUSSION Hans Freitag 1 participant 1 message Mar 3, 2002

lore
Share & tools
lore
#0 lore raw

Hi,

I'm using kernel 2.4.18-pre9.

I want to parse a mac adress within a kernel module. I want to use int sscanf(const char *buf, const char *fmt, ...) .

This function is located in /usr/src/linux/lib/vsprintf.c .

Mac addresses like 6f:6f:7f:9a:10:11 are parsed correctly, fd:23:22:fd:df:77 fails.

The reason is located in vsprintf.c line 640:

if (!*str || !isdigit(*str))

	break;

I think isxdigit(*str) might be better here.

bye

Signature · 1 line
May the source be with you!