From owner-freebsd-hackers@FreeBSD.ORG Sat May 1 22:35:34 2010 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E4140106564A for ; Sat, 1 May 2010 22:35:34 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id D80B48FC0C for ; Sat, 1 May 2010 22:35:34 +0000 (UTC) Received: by elvis.mu.org (Postfix, from userid 1192) id 8B2FC1A3F00; Sat, 1 May 2010 15:35:24 -0700 (PDT) Date: Sat, 1 May 2010 15:35:24 -0700 From: Alfred Perlstein To: hackers@freebsd.org Message-ID: <20100501223524.GU36233@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Cc: Subject: Coverity warning: strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 May 2010 22:35:35 -0000 I notice this code sprinkled through the sources: strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); This trips up coverity because it does not know for sure that the string returned by cam_sim_name() is going to be DEV_IDLEN-1 characters long. Should we switch these calls to strlcpy? Is there a smarter thing to do to code more defensively? thank you, -- - Alfred Perlstein .- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250, 07 zx10 .- FreeBSD committer