From owner-freebsd-bugs Fri Jun 21 4: 0:40 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id DC9B337B415 for ; Fri, 21 Jun 2002 04:00:09 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5LB09I42879; Fri, 21 Jun 2002 04:00:09 -0700 (PDT) (envelope-from gnats) Received: from nwww.freebsd.org (www.FreeBSD.org [216.136.204.117]) by hub.freebsd.org (Postfix) with ESMTP id C0E4837B447 for ; Fri, 21 Jun 2002 03:56:26 -0700 (PDT) Received: from www.freebsd.org (localhost [127.0.0.1]) by nwww.freebsd.org (8.12.2/8.12.2) with ESMTP id g5LAuIhG087381 for ; Fri, 21 Jun 2002 03:56:18 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.2/8.12.2/Submit) id g5LAuI3i087380; Fri, 21 Jun 2002 03:56:18 -0700 (PDT) Message-Id: <200206211056.g5LAuI3i087380@www.freebsd.org> Date: Fri, 21 Jun 2002 03:56:18 -0700 (PDT) From: Peter N Lewis To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/39617: traceroute fd_set allocation bug Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 39617 >Category: bin >Synopsis: traceroute fd_set allocation bug >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: Fri Jun 21 04:00:09 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Peter N Lewis >Release: N/A >Organization: Stairways Software >Environment: N/A >Description: traceroute.c does this: nfds = howmany(sock + 1, NFDBITS); if ((fdsp = malloc(nfds)) == NULL) err(1, "malloc"); memset(fdsp, 0, nfds); this is not valid since the fd_set is made up of fd_mask. nfds should be: nfds = howmany(sock + 1, NFDBITS) * sizeof(fd_mask); >How-To-Repeat: Run traceroute with pre-opened files such that sock (global variable s, the receiving socket) is greater than 7. In normal operation, it is usally 3 or 4 which is why this bug remains undetected. >Fix: nfds = howmany(sock + 1, NFDBITS) * sizeof(fd_mask); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message