From patchwork Fri Mar 23 01:07:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 889748 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-91224-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="anziXgJO"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 406llH6nvRz9s1r for ; Fri, 23 Mar 2018 12:07:55 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=B4qH6s0eF9MajCwEfahN/rhUw9OnVcUHpGOEaY5d7tHw/RljKSpk8 7OKKXPSH8zdSDitaX4XsVXGnsnoorn57nvQECxxyQgt4im54V1WhDJ4HnZkSpPyp kkgVXqsw5jpyL/c6Z/6RwnraNL1Zbesm9qDF9jHRK+km0ewlhGN0hg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=PvxUblTQ8bf/fMaFQPWhxU8utHA=; b=anziXgJO+B2FrZHDS7sAQWsdjLNd 34/ynxDLWmbOPEsbtH08jNxPe3n8WORclfddNtG0ejTiUG9BMnxL5QFhx6tl3OQO TnzMPyE+nkYedW1+KGRmW5w+0neIUIf9XeJvwdRLG8Deoi9brZzLNbX7aerjyuB2 OwJUPsDHCvGF9Yg= Received: (qmail 105496 invoked by alias); 23 Mar 2018 01:07:49 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 105018 invoked by uid 89); 23 Mar 2018 01:07:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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.2 spammy=nis, Hx-languages-length:1141 X-HELO: mail-pf0-f196.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=q4ElP4rXQi+FHSiZeNBhRbK7UGORN2x7E+47TXY8tvg=; b=igJKtdqN8wdun7RdVhDU/9fL4/yRstYa8j01F9Uvi5Kw3ka8IRqW36L1EoyoAqETKc oz5gihgqv3hYSc5fFuZE/spPRltkiwjLHk0NxuYlIWHoEYxnaymr+0uCywu1Q56zhLFt pPl2Za1yHGi2PdkqwkjVhVrboSnfeEwHQwflTapNOZYjLdCbsbY09i+F540CucTBExgR E11UkBTyQhcP0xNdMKxzyNoUTlrWjTRcgmSYUhrP4rXsziBdA675fQOL7DwDcs8ftZ5X f8Si2WUcFWH5lFKXTUJ22Fq8ZT6p46+YYC0t9zM5nehGSG4ctUxNMbCc+mKqvIx4b+qY /zMw== X-Gm-Message-State: AElRT7HxqvfS9t5OK11z+qpQmI8yyK+i99PXpXE2SmZCM2RVXrhYweM6 XS1XjChPf1KLzBukcukbLPL77Q== X-Google-Smtp-Source: AG47ELuL58yyRc2azDG21Y+6+ki3F87IgVqbi8dXm+3bGRYdh6wu4oJKzRCGUHqIUBzxOGtRmXyh+A== X-Received: by 10.98.227.16 with SMTP id g16mr13881787pfh.171.1521767265300; Thu, 22 Mar 2018 18:07:45 -0700 (PDT) From: Khem Raj To: libc-alpha@sourceware.org Cc: Khem Raj Subject: [PATCH] Replace strncpy with memccpy to fix -Wstringop-truncation. Date: Thu, 22 Mar 2018 18:07:29 -0700 Message-Id: <20180323010729.41457-1-raj.khem@gmail.com> * nis/nss_nisplus/nisplus-parser.c: Replace strncpy with memcpy to avoid -Wstringop-truncation. --- 2018-03-22 Khem Raj * nis/nss_nisplus/nisplus-parser.c (_nss_nisplus_parse_pwent): Replace strncpy with memcpy to avoid -Wstringop-truncation. nis/nss_nisplus/nisplus-parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nis/nss_nisplus/nisplus-parser.c b/nis/nss_nisplus/nisplus-parser.c index 8dc021e73d..b53284f889 100644 --- a/nis/nss_nisplus/nisplus-parser.c +++ b/nis/nss_nisplus/nisplus-parser.c @@ -87,7 +87,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw, if (len >= room_left) goto no_more_room; - strncpy (first_unused, numstr, len); + memcpy (first_unused, numstr, len); first_unused[len] = '\0'; numstr = first_unused; } @@ -103,7 +103,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw, if (len >= room_left) goto no_more_room; - strncpy (first_unused, numstr, len); + memcpy (first_unused, numstr, len); first_unused[len] = '\0'; numstr = first_unused; }