[syslinux] 64bit bug in gethostip

Steffen Winterfeldt snwint at suse.de
Mon Aug 23 09:37:33 PDT 2004


Hi,

running gethostip on amd64 shows, e.g.:

# gethostip 128.0.0.1
128.0.0.1 128.0.0.1 FFFFFFFF80000001

The patch below fixes it:

--- gethostip.c
+++ gethostip.c
@@ -120,7 +120,7 @@
 
     if ( output & 4 ) {
       unsigned long addr = 
-	(((unsigned char *)host->h_addr)[0] << 24UL) +
+	((unsigned long) ((unsigned char *)host->h_addr)[0] << 24UL) +
 	(((unsigned char *)host->h_addr)[1] << 16UL) +
 	(((unsigned char *)host->h_addr)[2] <<  8UL) +
 	(((unsigned char *)host->h_addr)[3]);



Steffen




More information about the Syslinux mailing list