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: 26437 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; }