diff options
author | Rob Landley <rob@landley.net> | 2015-01-01 16:59:35 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-01-01 16:59:35 -0600 |
commit | 82effc97f9f2d1c258ea50cb11b130753b8ba805 (patch) | |
tree | f6c584d2b1675a91eb1a016977560ff7148c15a1 /toys/pending/dhcp.c | |
parent | 5f53d130b1eae9041cc88c0ffb89e2b5823da393 (diff) | |
download | toybox-82effc97f9f2d1c258ea50cb11b130753b8ba805.tar.gz |
Switch a lot of strncpy() calls to xstrncpy().
Diffstat (limited to 'toys/pending/dhcp.c')
-rw-r--r-- | toys/pending/dhcp.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/toys/pending/dhcp.c b/toys/pending/dhcp.c index c7ed1bfb..f8226db6 100644 --- a/toys/pending/dhcp.c +++ b/toys/pending/dhcp.c @@ -1230,16 +1230,14 @@ static void renew(void) // Sends a IP release request. static void release(void) { - int len = sizeof("255.255.255.255\0"); - char buffer[len]; + char buffer[sizeof("255.255.255.255\0")]; struct in_addr temp_addr; mode_app(); // send release packet if (state->status == STATE_BOUND || state->status == STATE_RENEWING || state->status == STATE_REBINDING) { temp_addr.s_addr = htonl(server); - strncpy(buffer, inet_ntoa(temp_addr), sizeof(buffer)); - buffer[len - 1] = '\0'; + xstrncpy(buffer, inet_ntoa(temp_addr), sizeof(buffer)); temp_addr.s_addr = state->ipaddr.s_addr; infomsg( infomode, "Unicasting a release of %s to %s", inet_ntoa(temp_addr), buffer); dhcpc_sendmsg(DHCPRELEASE); |