diff --git a/libifupdown/state.c b/libifupdown/state.c index 344a417..6421aaa 100644 --- a/libifupdown/state.c +++ b/libifupdown/state.c @@ -32,8 +32,13 @@ lif_state_read(struct lif_dict *state, FILE *fd) char *equals_p = strchr(linebuf, '='); if (*refcount) + { rc = strtoul(refcount, NULL, 10); + if (rc == 0 || rc == ULONG_MAX) + rc = 1; + } + if (equals_p == NULL) { lif_state_upsert(state, ifname, &(struct lif_interface){ .ifname = ifname, .refcount = rc });