Skip to content

Commit

Permalink
Return error when MAC address has an unexpected length
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed May 18, 2024
1 parent 1eb0630 commit 92f31ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gc/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ s32 net_init_async(netcallback cb, void *usrdata);
s32 net_get_status(void);
void net_wc24cleanup(void);
#endif
s32 net_get_mac_address(void *mac_buf);
s32 net_get_mac_address(u8 mac_buf[6]);
void net_deinit(void);

u32 net_gethostip(void);
Expand Down
4 changes: 2 additions & 2 deletions libogc/network_wii.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,10 @@ void net_wc24cleanup(void) {
}
}

s32 net_get_mac_address(void *mac_buf) {
s32 net_get_mac_address(u8 mac_buf[6]) {
s32 fd;
s32 result;
void *_mac_buf;
u8 *_mac_buf;
STACK_ALIGN(u32, manage_buf, 0x20, 32);

if (mac_buf==NULL) return -EINVAL;
Expand Down
3 changes: 2 additions & 1 deletion lwip/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -1612,9 +1612,10 @@ u32 net_gethostip(void)
return g_hNetIF.ip_addr.addr;
}

s32 net_get_mac_address(void *mac_buf)
s32 net_get_mac_address(u8 mac_buf[6])
{
if(mac_buf==NULL) return -EINVAL;
if(g_hNetIF.hwaddr_len!=6) return -ERANGE;
memcpy(mac_buf,g_hNetIF.hwaddr,g_hNetIF.hwaddr_len);
return 0;
}
Expand Down

0 comments on commit 92f31ff

Please sign in to comment.