[Etherboot-developers] (unsigned) char bugs
Brought to you by:
marty_connor,
stefanhajnoczi
|
From: Michael B. <mb...@fe...> - 2002-05-29 15:05:15
|
I've noticed some strange things happening when DHCP options get longer
than 128 characters (which is easily possible if you use the
extensions-path mechanism to load an external options file via TFTP).
I've tracked it down to the lack of "unsigned" when defining character
types in places like:
char *motd[RFC1533_VENDOR_NUMOFMOTD];
which causes problems in bootmenu.c, at the point
int i,j,k = 0;
for (i = 0; i < RFC1533_VENDOR_NUMOFMOTD; i++) if (motd[i]) {
for (j = TAG_LEN(motd[i])
since if the DHCP option length is >=128, j will either be set to the
correct length or (correct length-256), at the discretion of the compiler.
Explicitly specifying "unsigned char" fixes the problem. I've fixed the
ones I've come across, but it seems to be common problem in many locations
- it might be worth eliminating them all with a quick code review at some
point.
Michael Brown
http://www.fensystems.co.uk
|