Skip site navigation (1)Skip section navigation (2)
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:   bin/147303: restore(8) uses uninitialized variables: tape.c dirs.c
Message-ID:  <201006020116.o521G5tZ002573@www.freebsd.org>
Resent-Message-ID: <201006020120.o521K3Hu056312@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006020116.o521G5tZ002573>