Index: trunk/i386/libsaio/smbios.c =================================================================== --- trunk/i386/libsaio/smbios.c (revision 875) +++ trunk/i386/libsaio/smbios.c (revision 876) @@ -405,7 +405,7 @@ uint8_t *stringPtr = (uint8_t *)structHeader + structHeader->length; if (!field) - return (char *)0; + return NULL; for (field--; field != 0 && strlen((char *)stringPtr) > 0; field--, stringPtr = (uint8_t *)((uint32_t)stringPtr + strlen((char *)stringPtr) + 1)); @@ -428,7 +428,7 @@ strSize = strlen(string); // remove any spaces found at the end - while ((string[strSize - 1] == ' ') && strSize != 0) + while ((strSize != 0) && (string[strSize - 1] == ' ')) strSize--; if (strSize == 0) @@ -604,10 +604,8 @@ memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length); for (i = 0; i < numOfSetters; i++) - if (structPtr->orig->type == SMBSetters[i].type) + if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structPtr->orig->length)) { - if (SMBSetters[i].fieldOffset > structPtr->orig->length) - continue; setterFound = true; setSMBValue(structPtr, i, (returnType *)((uint8_t *)structPtr->new + SMBSetters[i].fieldOffset)); }