NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/54574: usr.bin/make/parse.c $Id: 1.231 drops core on NetBSD-5.2 in realpath(3)



The following reply was made to PR toolchain/54574; it has been noted by GNATS.

From: "Simon J. Gerraty" <sjg%juniper.net@localhost>
To: Brian Buhrow <buhrow%nfbcal.org@localhost>
Cc: <gnats-bugs%netbsd.org@localhost>, <gnats-admin%netbsd.org@localhost>,
        <netbsd-bugs%netbsd.org@localhost>, <sjg%juniper.net@localhost>
Subject: Re: bin/54574: usr.bin/make/parse.c $Id: 1.231 drops core on NetBSD-5.2 in realpath(3)
Date: Thu, 26 Sep 2019 12:57:53 -0700

 Brian Buhrow <buhrow%nfbcal.org@localhost> wrote:
 
 > 	hello.  Here is the stack trace.  I don't have debugging symbols in
 > the binaries, but this should give you an idea.
 > Let me know if you need anything else.
 
 Thanks.
 Odd. By the time vfprintf is called we are already done with reporting
 the makefile path.
 
 Oh never mind, we should not be attempting to free return from realpath.
 Can you please try the patch below.
 
 Index: parse.c
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/make/parse.c,v
 retrieving revision 1.232
 diff -u -p -r1.232 parse.c
 --- parse.c	9 Apr 2019 18:28:10 -0000	1.232
 +++ parse.c	26 Sep 2019 19:55:44 -0000
 @@ -670,6 +670,7 @@ ParseVErrorInternal(FILE *f, const char 
      const char *fmt, va_list ap)
  {
  	static Boolean fatal_warning_error_printed = FALSE;
 +	char dirbuf[MAXPATHLEN+1];
  
  	(void)fprintf(f, "%s: ", progname);
  
 @@ -688,9 +689,7 @@ ParseVErrorInternal(FILE *f, const char 
  			if (dir == NULL)
  				dir = ".";
  			if (*dir != '/') {
 -				dir = cp2 = realpath(dir, NULL);
 -				free(cp);
 -				cp = cp2; /* cp2 set to NULL by Var_Value */
 +				dir = realpath(dir, dirbuf);
  			}
  			fname = Var_Value(".PARSEFILE", VAR_GLOBAL, &cp2);
  			if (fname == NULL) {
 


Home | Main Index | Thread Index | Old Index