>Number: 165492 >Category: misc >Synopsis: bsdinstall segmentation fault >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 26 20:20:00 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Fernnado >Release: 9.0-RELEASE >Organization: >Environment: FreeBSD hammer 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Fri Feb 17 18:27:35 CET 2012 root@hammer:/usr/obj/usr/src/sys/APEKERNEL9 amd64
>Description: bsdinstall distextract|distfetch causes a segmentation fault when invoked from an installed system. It does not check for the presence of the DISTRIBUTIONS variable in the environment. >How-To-Repeat: Invoke either bsdinstall distfetch or bsdinstall distextract >Fix: Apply the attached patch to properly check for the presence of the DISTRIBUTIONS variable before trying to make a copy Patch attached with submission follows: Files /usr/src/usr.sbin/bsdinstall/distextract/distextract and ./distextract/distextract differ diff -ruN /usr/src/usr.sbin/bsdinstall/distextract/distextract.c ./distextract/distextract.c --- /usr/src/usr.sbin/bsdinstall/distextract/distextract.c 2012-01-03 04:25:48.000000000 +0100 +++ ./distextract/distextract.c 2012-02-26 20:49:34.000000000 +0100 @@ -38,9 +38,16 @@ int main(void) { - char *diststring = strdup(getenv("DISTRIBUTIONS")); + char *diststring; const char **dists; int i, retval, ndists = 0; + + if (getenv("DISTRIBUTIONS") == NULL) { + fprintf(stderr, "DISTRIBUTIONS variable is not set\n"); + return (1); + } + + diststring = strdup(getenv("DISTRIBUTIONS")); for (i = 0; diststring[i] != 0; i++) if (isspace(diststring[i]) && !isspace(diststring[i+1])) ndists++; Files /usr/src/usr.sbin/bsdinstall/distextract/distextract.o and ./distextract/distextract.o differ Files /usr/src/usr.sbin/bsdinstall/distfetch/distfetch and ./distfetch/distfetch differ diff -ruN /usr/src/usr.sbin/bsdinstall/distfetch/distfetch.c ./distfetch/distfetch.c --- /usr/src/usr.sbin/bsdinstall/distfetch/distfetch.c 2012-01-03 04:25:48.000000000 +0100 +++ ./distfetch/distfetch.c 2012-02-26 20:49:39.000000000 +0100 @@ -37,9 +37,16 @@ int main(void) { - char *diststring = strdup(getenv("DISTRIBUTIONS")); + char *diststring; char **urls; int i, nfetched, ndists = 0; + + if (getenv("DISTRIBUTIONS") == NULL) { + fprintf(stderr, "DISTRIBUTIONS variable is not set\n"); + return (1); + } + + diststring = strdup(getenv("DISTRIBUTIONS")); for (i = 0; diststring[i] != 0; i++) if (isspace(diststring[i]) && !isspace(diststring[i+1])) ndists++; Files /usr/src/usr.sbin/bsdinstall/distfetch/distfetch.o and ./distfetch/distfetch.o differ >Release-Note: >Audit-Trail: >Unformatted: _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"