From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78871 invoked by alias); 26 Feb 2020 02:35:59 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 78862 invoked by uid 89); 26 Feb 2020 02:35:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-pj1-f47.google.com Received: from mail-pj1-f47.google.com (HELO mail-pj1-f47.google.com) (209.85.216.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 26 Feb 2020 02:35:58 +0000 Received: by mail-pj1-f47.google.com with SMTP id d5so595786pjz.5 for ; Tue, 25 Feb 2020 18:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=UhyoIqb/1Ez9gwvnP+cVcQ7eQ2aNKsy9rusoEfjChy0=; b=MeBpcjDqKtLtAliQVbpnIhxUX+0mrxulB4gEFMjqh+OF6jTH6UzhRVbbFNgHb+HL1D b1SU4rSp79fjpKQjLHdp8/seq9P+pxvt1tjVjLvwlBEZnvaXk5JoIG/OIfaWlNBUDFis jdu7YVVULfQ/zzTUyBH68cUVOkR4bEN3ROIg3BfzUCSWVYzWpi8gQB98Z0c0w67JvJNV BwGzEfWRHPja0fVVrd3J6OB4PhM2oYQX02X7Db5aYB1fUdvDLOE39mRMaz5ldJ+IcVct nZfT7LNhVKqn5b/sQ0twGsXO9JzH/H9tK6uSQm3HPaKR3o85a6xVj6ZULYWxoupsotI9 ZvGg== Return-Path: Received: from bubble.grove.modra.org ([2406:3400:51d:8cc0:a0d2:f6ab:12f5:1b30]) by smtp.gmail.com with ESMTPSA id m12sm442617pfh.37.2020.02.25.18.35.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2020 18:35:55 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id AD8958085E; Wed, 26 Feb 2020 13:05:51 +1030 (ACDT) Date: Wed, 26 Feb 2020 02:35:00 -0000 From: Alan Modra To: binutils@sourceware.org Subject: gas strncpy warning Message-ID: <20200226023551.GD5750@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00545.txt.bz2 Avoid a warning that the buffer may not be zero terminated. * read.c (read_a_source_file): Call strncpy with length one less than size of original_case_string. diff --git a/gas/read.c b/gas/read.c index e603099e94..784d6a8f79 100644 --- a/gas/read.c +++ b/gas/read.c @@ -1052,7 +1052,8 @@ read_a_source_file (const char *name) { char *s2 = s; - strncpy (original_case_string, s2, sizeof (original_case_string)); + strncpy (original_case_string, s2, + sizeof (original_case_string) - 1); original_case_string[sizeof (original_case_string) - 1] = 0; while (*s2) -- Alan Modra Australia Development Lab, IBM