From nobody@FreeBSD.org  Wed Jun  2 01:16:05 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AAC961065672
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  2 Jun 2010 01:16:05 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 7ACFE8FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  2 Jun 2010 01:16:05 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o521G5pi002574
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 2 Jun 2010 01:16:05 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o521G5tZ002573;
	Wed, 2 Jun 2010 01:16:05 GMT
	(envelope-from nobody)
Message-Id: <201006020116.o521G5tZ002573@www.freebsd.org>
Date: Wed, 2 Jun 2010 01:16:05 GMT
From: FreeBSD 8 /sbin/restore <freebsd-bugs@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: restore(8) uses uninitialized variables: tape.c dirs.c
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         147303
>Category:       bin
>Synopsis:       restore(8) uses uninitialized variables: tape.c dirs.c
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 02 01:20:03 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     FreeBSD 8 /sbin/restore
>Release:        FreeBSD {2,3,4,5,6,7,8}R
>Organization:
>Environment:
>Description:
in /sbin/restore(8)<tape.c>getvol():
if goto "gethdr" (line 336), variable "newvol" (line 421) is uninitialized.
others are some exist (dirs.c, ...).
"-Wall".

http://www.freebsd.org/cgi/cvsweb.cgi/src/sbin/restore/tape.c?rev=1.56
Revision 1.56
Sat Feb 13 10:22:07 2010 UTC (3 months, 2 weeks ago) by jh
Branches: MAIN
CVS tags: HEAD
   312	void
   313	getvol(long nextvol)
   314	{
   315		int64_t prevtapea;
   316		long i, newvol, savecnt;
   317		union u_spcl tmpspcl;
   318	#	define tmpbuf tmpspcl.s_spcl
   319		char buf[TP_BSIZE];
   320	
   321		if (nextvol == 1) {
   322			tapesread = 0;
   323			gettingfile = 0;
   324		}
   325		prevtapea = tapeaddr;
   325		savecnt = blksread;
   327		if (pipein) {
   328			if (nextvol != 1) {
   329				panic("Changing volumes on pipe input?\n");
   330				/* Avoid looping if we couldn't ask the user. */
   331				if (yflag || ferror(terminal) || feof(terminal))
   332					done(1);
   333			}
   334			if (volno == 1)
   335				return;
   336			goto gethdr;
   337		}
   338	again:
 :
   415		if (mt == -1) {
   416			fprintf(stderr, "Cannot open %s\n", magtape);
   417			volno = -1;
   418			goto again;
   419		}
   420	gethdr:
   421		volno = newvol;
>How-To-Repeat:
gcc -Wall
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:
