From tenser@odin.ecsel.psu.edu  Sat Mar 29 01:43:13 1997
Received: from odin.ecsel.psu.edu (qmailr@odin.ecsel.psu.edu [146.186.218.62])
          by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id BAA17804
          for <FreeBSD-gnats-submit@freebsd.org>; Sat, 29 Mar 1997 01:43:12 -0800 (PST)
Received: (qmail 549 invoked by uid 1000); 29 Mar 1997 09:43:09 -0000
Message-Id: <19970329094309.548.qmail@odin.ecsel.psu.edu>
Date: 29 Mar 1997 09:43:09 -0000
From: Dan Cross <tenser@spitfire.ecsel.psu.edu>
Reply-To: tenser@spitfire.ecsel.psu.edu
To: FreeBSD-gnats-submit@freebsd.org
Subject: bug in qcamcontrol...
X-Send-Pr-Version: 3.2

>Number:         3139
>Category:       bin
>Synopsis:       qcamcontrol has a bug where I/O errors are not reported.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 29 01:50:01 PST 1997
>Closed-Date:    Mon May 25 15:31:23 PDT 1998
>Last-Modified:  Mon May 25 15:32:07 PDT 1998
>Originator:     Dan Cross
>Release:        FreeBSD 2.2-RELEASE i386
>Organization:
PSU Mathematics
>Environment:

	Pentium, 16 MB RAM, 1.2GB disk, Connectix QuickCam.

>Description:

	The read loop in qcamcontrol.c keeps a count of the current
	number of bytes read in the variable ``bytes'' defined as
	type size_t.  In the loop, is tested for values less than
	zero to detect errors.  However, size_t is defined by our
	buddies over at ANSI as being an unsigned integral value,
	thus the negative is never detected.  Further, bytes should
	really be ssize_t, as that is what read(2) is defined to
	return, and that is a signed value.

>How-To-Repeat:

	Try reading from a broken QuickCam.  Notice the infinte loop.  :-)

>Fix:
	
	A patch is included below; it merely changes the type of
	``bytes'' to be ssize_t, as specified by the read(2) man
	page.

*** qcamcontrol.c	1997/03/29 09:32:14	1.1
--- qcamcontrol.c	1997/03/29 09:41:08
***************
*** 69,75 ****
  {
  	struct qcam info;
  	int fd, len;
! 	size_t bytes;
  	char opt;
  
  	static char buffer[QC_MAX_XSIZE*QC_MAX_YSIZE];
--- 69,75 ----
  {
  	struct qcam info;
  	int fd, len;
! 	ssize_t bytes;
  	char opt;
  
  	static char buffer[QC_MAX_XSIZE*QC_MAX_YSIZE];
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Mon May 25 15:31:23 PDT 1998 
State-Changed-Why:  
Michael Smith removed the qcam support programs not too long ago. 
>Unformatted:
