diff --git a/sys/net/ipfw3/ip_fw3.c b/sys/net/ipfw3/ip_fw3.c --- a/sys/net/ipfw3/ip_fw3.c +++ b/sys/net/ipfw3/ip_fw3.c @@ -177,7 +177,11 @@ if (tmp->type == 0) { tmp->type = 1; tmp->id = module_id; - strncpy(tmp->name, module_name, strlen(module_name)); + /* DF-0476: use strlcpy with the destination buffer size + * instead of strncpy with the source length. The old + * code overflowed name[20] when strlen(module_name) >= 20 + * and never wrote a NUL terminator. */ + strlcpy(tmp->name, module_name, sizeof(tmp->name)); break; } tmp++;