This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix crash in nscd GETAI call


Testcase: getent ahosts irc.freenode.net

Andreas.

2010-04-09  Andreas Schwab  <schwab@redhat.com>

	* nscd/aicache.c (addhstaiX): Don't crash on missing canonical
	name.

---
 nscd/aicache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/nscd/aicache.c b/nscd/aicache.c
index 992357d..1b3a7ee 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -166,7 +166,7 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
 		addrslen += IN6ADDRSZ;
 	    }
 	  canon = at->name;
-	  canonlen = strlen (canon) + 1;
+	  canonlen = canon == NULL ? 0 : strlen (canon) + 1;
 
 	  total = sizeof (*dataset) + naddrs + addrslen + canonlen;
 
-- 
1.7.0.1


-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]