From f81931a79904414228464cc1db6767badd8eb716 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Sat, 22 Mar 2014 20:36:31 +0100 Subject: [PATCH] Red Hat issue 1021972: fixed a missing NUL termination in return string of sysutils.c:sockaddr_info() for the AF_UNIX case --- CHANGES | 3 +++ sysutils.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 9256b62..bbcc7a5 100644 --- a/CHANGES +++ b/CHANGES @@ -28,6 +28,9 @@ corrections: Red Hat issue 1021958: fixed a bug with faulty buffer/data length calculation in xio-ascii.c:_xiodump() + + Red Hat issue 1021972: fixed a missing NUL termination in return string + of sysutils.c:sockaddr_info() for the AF_UNIX case fixed bug in xio-openssl.c that prevented error handling of bad number of arguments, thanks to Paulik Tamas for reporting diff --git a/sysutils.c b/sysutils.c index c5cd9a8..3dfda60 100644 --- a/sysutils.c +++ b/sysutils.c @@ -1,5 +1,5 @@ /* source: sysutils.c */ -/* Copyright Gerhard Rieger 2001-2012 */ +/* Copyright Gerhard Rieger */ /* Published under the GNU General Public License V.2, see file COPYING */ /* translate socket addresses into human readable form */ @@ -189,7 +189,7 @@ char *sockaddr_info(const struct sockaddr *sa, socklen_t salen, char *buff, size case 0: case AF_UNIX: sockaddr_unix_info(&sau->un, salen, cp+1, blen-1); cp[0] = '"'; - *strchr(cp+1, '\0') = '"'; + strncat(cp+1, "\"", 1); break; #endif #if WITH_IP4