From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f67.google.com ([209.85.160.67]:40698 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751595AbeCTU3Y (ORCPT ); Tue, 20 Mar 2018 16:29:24 -0400 Received: by mail-pl0-f67.google.com with SMTP id x4-v6so1716395pln.7 for ; Tue, 20 Mar 2018 13:29:23 -0700 (PDT) From: Stephen Hemminger To: netdev@vger.kernel.org Cc: Stephen Hemminger Subject: [PATCH iproute2 v2 8/9] misc: avoid snprintf warnings in ss and nstat Date: Tue, 20 Mar 2018 13:29:08 -0700 Message-Id: <20180320202909.22166-9-stephen@networkplumber.org> In-Reply-To: <20180320202909.22166-1-stephen@networkplumber.org> References: <20180320202909.22166-1-stephen@networkplumber.org> Sender: netdev-owner@vger.kernel.org List-ID: Gcc 8 checks that target buffer is big enough. Signed-off-by: Stephen Hemminger --- misc/nstat.c | 4 ++-- misc/ss.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/nstat.c b/misc/nstat.c index a4dd405d43a9..433a1f483be3 100644 --- a/misc/nstat.c +++ b/misc/nstat.c @@ -178,12 +178,12 @@ static int count_spaces(const char *line) static void load_ugly_table(FILE *fp) { - char buf[4096]; + char buf[2048]; struct nstat_ent *db = NULL; struct nstat_ent *n; while (fgets(buf, sizeof(buf), fp) != NULL) { - char idbuf[sizeof(buf)]; + char idbuf[4096]; int off; char *p; int count1, count2, skip = 0; diff --git a/misc/ss.c b/misc/ss.c index e087bef739b0..a03fa4a7c174 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -4032,7 +4032,7 @@ static int netlink_show_one(struct filter *f, if (!pid) { done = 1; - strncpy(procname, "kernel", 6); + strncpy(procname, "kernel", 7); } else if (pid > 0) { FILE *fp; -- 2.16.2