mirror of
https://github.com/simh/simh.git
synced 2026-01-25 19:56:25 +00:00
ETHER: Fix fault when parsing bad NAT: parameters adding better error reporting
This commit is contained in:
@@ -1572,10 +1572,10 @@ static void eth_get_nic_hw_addr(ETH_DEV* dev, const char *devname)
|
||||
|
||||
memset(command, 0, sizeof(command));
|
||||
/* try to force an otherwise unused interface to be turned on */
|
||||
snprintf(command, sizeof(command)-1, "ifconfig %s up", devname);
|
||||
snprintf(command, sizeof(command)-1, "ifconfig %.*s up", (int)(sizeof(command) - 14), devname);
|
||||
(void)system(command);
|
||||
for (i=0; patterns[i] && (0 == dev->have_host_nic_phy_addr); ++i) {
|
||||
snprintf(command, sizeof(command)-1, "ifconfig %s | %s >NIC.hwaddr", devname, patterns[i]);
|
||||
snprintf(command, sizeof(command)-1, "ifconfig %.*s | %s >NIC.hwaddr", (int)(sizeof(command) - (26 + strlen(patterns[i]))), devname, patterns[i]);
|
||||
(void)system(command);
|
||||
if (NULL != (f = fopen("NIC.hwaddr", "r"))) {
|
||||
while (0 == dev->have_host_nic_phy_addr) {
|
||||
@@ -2118,7 +2118,7 @@ else { /* !tap: */
|
||||
|
||||
while (isspace(*devname))
|
||||
++devname;
|
||||
if (!(*handle = (void*) sim_slirp_open(devname, opaque, &_slirp_callback, dptr, dbit)))
|
||||
if (!(*handle = (void*) sim_slirp_open(devname, opaque, &_slirp_callback, dptr, dbit, errbuf, PCAP_ERRBUF_SIZE)))
|
||||
strlcpy(errbuf, strerror(errno), PCAP_ERRBUF_SIZE);
|
||||
else {
|
||||
*eth_api = ETH_API_NAT;
|
||||
|
||||
Reference in New Issue
Block a user