修改原版代码中strlcpy最大8个字节的限制, "enp175s0f0"这种网卡名被截断的BUG.
This commit is contained in:
@@ -73,7 +73,8 @@ get_interface(interface_list_t *list, const char *alias)
|
||||
} while (ptr != NULL);
|
||||
} else {
|
||||
name = (char *)safe_malloc(strlen(alias) + 1);
|
||||
strlcpy(name, alias, sizeof(name));
|
||||
memset(name, 0, strlen(alias) + 1);
|
||||
strncpy(name, alias, strlen(alias) + 1);
|
||||
return(name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user