misc: avoid snprintf warnings in ss and nstat

Gcc 8 checks that target buffer is big enough.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Stephen Hemminger 2018-03-19 16:23:18 -07:00
parent d5732e3470
commit da8034a019
2 changed files with 3 additions and 3 deletions

View File

@ -178,12 +178,12 @@ static int count_spaces(const char *line)
static void load_ugly_table(FILE *fp) static void load_ugly_table(FILE *fp)
{ {
char buf[4096]; char buf[2048];
struct nstat_ent *db = NULL; struct nstat_ent *db = NULL;
struct nstat_ent *n; struct nstat_ent *n;
while (fgets(buf, sizeof(buf), fp) != NULL) { while (fgets(buf, sizeof(buf), fp) != NULL) {
char idbuf[sizeof(buf)]; char idbuf[4096];
int off; int off;
char *p; char *p;
int count1, count2, skip = 0; int count1, count2, skip = 0;

View File

@ -4093,7 +4093,7 @@ static int netlink_show_one(struct filter *f,
if (!pid) { if (!pid) {
done = 1; done = 1;
strncpy(procname, "kernel", 6); strncpy(procname, "kernel", 7);
} else if (pid > 0) { } else if (pid > 0) {
FILE *fp; FILE *fp;