The original issue was that filter.name might end up unterminated if
user provided string was too long. But in fact it is not necessary to
copy the commandline parameter at all: just make filter.name point to it
instead.
Signed-off-by: Phil Sutter <phil@nwl.cc>
int family;
int index;
#define NONE_DEV (-1)
- char name[1024];
+ const char *name;
} filter;
static void usage(void) __attribute__((noreturn));
if (tb[NDTA_NAME]) {
const char *name = rta_getattr_str(tb[NDTA_NAME]);
- if (strlen(filter.name) > 0 && strcmp(filter.name, name))
+ if (filter.name && strcmp(filter.name, name))
return 0;
}
if (tb[NDTA_PARMS]) {
} else if (strcmp(*argv, "name") == 0) {
NEXT_ARG();
- strncpy(filter.name, *argv, sizeof(filter.name));
+ filter.name = *argv;
} else
invarg("unknown", *argv);