Bug#565634: [Hostname-devel] Bug#565634: hostname -A prints broken output

2010-01-19 Thread Michael Meskes
On Tue, Jan 19, 2010 at 01:51:44AM +0100, Marco d'Itri wrote:
> Indeed, you are not supposed to use the buffer if getnameinfo(2) fails
> (because I have an interface with no rDNS).

Apparently all my systems had that buffer memory set to zero.

> Patch attached.

Thanks, upload on its way.

Michael

-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber mes...@jabber.org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#565634: [Hostname-devel] Bug#565634: hostname -A prints broken output

2010-01-18 Thread Marco d'Itri
On Jan 18, Michael Meskes  wrote:

> Could you please debug hostname? It printfs buf in line 317 which is set by
> calling getnameinfo in line 310. Does getnameinfo really return this 
> character?
> Or is an error return not correctly caught?
Indeed, you are not supposed to use the buffer if getnameinfo(2) fails
(because I have an interface with no rDNS).
Patch attached.

-- 
ciao,
Marco
--- a/hostname.c	2010-01-15 13:12:12.0 +0100
+++ b/hostname.c	2010-01-19 01:48:05.337523465 +0100
@@ -311,10 +311,11 @@
 		  buf, sizeof(buf), NULL, 0, flags);
 
 /* Just skip addresses that cannot be translated */
-if (ret != 0 && (type != ALL_FQDNS || ret != EAI_NONAME))
+if (ret != 0) {
+if (type != ALL_FQDNS && ret != EAI_NONAME)
 	errx(1, "%s", gai_strerror(ret));
-
-printf("%s ", buf);
+} else
+	printf("%s ", buf);
 			}
 			printf("\n");
 			freeifaddrs(ifa);


signature.asc
Description: Digital signature


Bug#565634: [Hostname-devel] Bug#565634: hostname -A prints broken output

2010-01-18 Thread Michael Meskes
On Sun, Jan 17, 2010 at 04:04:08PM +0100, Marco d'Itri wrote:
> m...@bongo:~$ hostname -A | hd
>   7f b7 01 20 61 64 73 6c  2d 75 6c 6c 2d 36 39 2d  |.·. adsl-ull-69-|
> 0010  31 38 39 2e 34 38 2d 31  35 31 2e 6e 65 74 32 34  |189.48-151.net24|
> 0020  2e 69 74 20 0a|.it .|
> 0025
> m...@bongo:~$ hostname -A
> Š· adsl-ull-69-189.48-151.net24.it 

Could you please debug hostname? It printfs buf in line 317 which is set by
calling getnameinfo in line 310. Does getnameinfo really return this character?
Or is an error return not correctly caught?

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber mes...@jabber.org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org