From owner-freebsd-bugs Mon Sep 14 03:30:10 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id DAA14984 for freebsd-bugs-outgoing; Mon, 14 Sep 1998 03:30:10 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id DAA14918 for ; Mon, 14 Sep 1998 03:30:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id DAA15100; Mon, 14 Sep 1998 03:30:00 -0700 (PDT) Received: (from nobody@localhost) by hub.freebsd.org (8.8.8/8.8.8) id DAA14681; Mon, 14 Sep 1998 03:27:17 -0700 (PDT) (envelope-from nobody) Message-Id: <199809141027.DAA14681@hub.freebsd.org> Date: Mon, 14 Sep 1998 03:27:17 -0700 (PDT) From: sp@alkor.ru To: freebsd-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: www-1.0 Subject: misc/7926: Probable weak code /usr/bin/cksum Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 7926 >Category: misc >Synopsis: Probable weak code /usr/bin/cksum >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Sep 14 03:30:00 PDT 1998 >Last-Modified: >Originator: Sergey Potapov >Organization: Alkor Telecom SPb Russia >Release: 2.2.6-RELEASE >Environment: FreeBSD ws.alkor.ru 2.2.6-RELEASE FreeBSD 2.2.6-RELEASE #0: Fri Apr 3 16:50:57 MSD 1998 sp@backup.alkor.ru:/usr/src/sys/compile/WORKSTAT i386 >Description: the code (/usr/src/usr.bin/cksum/crc32.c): while ((nr = read(fd, buf, sizeof(buf)))) for (len += nr, p = buf; nr--; ++p) { CRC(crc, *p) ; CRC(crc32_total, *p) ; } if (nr < 0) return 1 ; IMHO may cause infinite loop or crash of utility. I cannot predict results if read(2) will return -1 everytime. I did not check other modules there. >How-To-Repeat: >Fix: Probably should use: while ((nr = read(fd, buf, sizeof(buf))) > 0) instead of: while ((nr = read(fd, buf, sizeof(buf)))) >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message