From 6e2b4f07ecfc31f077537c33ce67f778dc323d06 Mon Sep 17 00:00:00 2001 From: grant Date: Fri, 18 Nov 2005 03:31:11 +0000 Subject: pass const empty string to MAKEEXTRALIST macro instead of the anonymous empty string. the macro uses the argument multiple times and the logic relies on identical strings having the same address, which is compiler dependent and not guaranteed to be the case. problem observed with pax(1) built with sunpro 11 on Solaris. from segv@netctl.net in PR pkg/32097. --- pkgtools/libnbcompat/files/vis.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'pkgtools/libnbcompat') diff --git a/pkgtools/libnbcompat/files/vis.c b/pkgtools/libnbcompat/files/vis.c index dd9cc1da1c1..a3427e04418 100644 --- a/pkgtools/libnbcompat/files/vis.c +++ b/pkgtools/libnbcompat/files/vis.c @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.7 2004/08/23 03:32:13 jlam Exp $ */ +/* $NetBSD: vis.c,v 1.8 2005/11/18 03:31:11 grant Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -68,7 +68,7 @@ #include #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.7 2004/08/23 03:32:13 jlam Exp $"); +__RCSID("$NetBSD: vis.c,v 1.8 2005/11/18 03:31:11 grant Exp $"); #endif /* LIBC_SCCS and not lint */ #if 0 @@ -329,10 +329,11 @@ vis(dst, c, flag, nextc) { char *extra; + const char *emptystr = ""; _DIAGASSERT(dst != NULL); - MAKEEXTRALIST(flag, extra, ""); + MAKEEXTRALIST(flag, extra, emptystr); if (flag & VIS_HTTPSTYLE) HVIS(dst, c, flag, nextc, extra); else @@ -359,8 +360,9 @@ strvis(dst, src, flag) int flag; { char *extra; + const char *emptystr = ""; - MAKEEXTRALIST(flag, extra, ""); + MAKEEXTRALIST(flag, extra, emptystr); return (strsvis(dst, src, flag, extra)); } @@ -373,7 +375,8 @@ strvisx(dst, src, len, flag) int flag; { char *extra; + const char *emptystr = ""; - MAKEEXTRALIST(flag, extra, ""); + MAKEEXTRALIST(flag, extra, emptystr); return (strsvisx(dst, src, len, flag, extra)); } -- cgit v1.2.3