[En-Nut-Discussion] Confos.Hostname defaulting

Damian Slee damian at commtech.com.au
Fri Apr 16 10:14:00 CEST 2004


New NutLoadConfig() checks length of host name, clears it if no nul
termination.


int NutLoadConfig(void)
{
	int len;
    eeprom_read_block(&confos, CONFOS_EE_OFFSET, sizeof(CONFOS));
	len = strlen(confos.hostname);
    if (confos.size != sizeof(CONFOS) || 
		confos.magic[0] != 'O' || confos.magic[1] != 'S' ||
		(len>=sizeof(confos.hostname))) {  /* valid host name?
*/

		memset(confos.hostname, 0 ,sizeof(confos.hostname));  /*
empty string */
        return -1;
    }
    return 0;
}



More information about the En-Nut-Discussion mailing list