diff options
author | Sascha Hauer <sha@octopus.labnet.pengutronix.de> | 2007-09-28 10:47:19 +0200 |
---|---|---|
committer | Sascha Hauer <sha@octopus.labnet.pengutronix.de> | 2007-09-28 10:47:19 +0200 |
commit | 6b7fdcb9702516faa3b125431c6212c0ebb3c8a6 (patch) | |
tree | a133316630e367f70d6dfa86a0d301e5302d1910 /net | |
parent | 5931ed5a14f56526f63c59d9ddbbae59b9a639cd (diff) | |
download | barebox-6b7fdcb9702516faa3b125431c6212c0ebb3c8a6.tar.gz barebox-6b7fdcb9702516faa3b125431c6212c0ebb3c8a6.tar.xz |
Use safe_strncpy() instead of copy_filename(). The shell has already removed
quotes, so we don't need this functionality from copy_filename()
Diffstat (limited to 'net')
-rw-r--r-- | net/bootp.c | 5 | ||||
-rw-r--r-- | net/net.c | 13 |
2 files changed, 3 insertions, 15 deletions
diff --git a/net/bootp.c b/net/bootp.c index 419a40e2b6..7340ed9875 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -20,6 +20,7 @@ #include <environment.h> #include <clock.h> #include <net.h> +#include <libbb.h> #include "bootp.h" #include "tftp.h" #include "nfs.h" @@ -106,7 +107,7 @@ static void BootpCopyNetParams(Bootp_t *bp) NetCopyIP(&NetServerIP, &bp->bp_siaddr); memcpy (NetServerEther, ((Ethernet_t *)NetRxPkt)->et_src, 6); if (strlen(bp->bp_file) > 0) - copy_filename (BootFile, bp->bp_file, sizeof(BootFile)); + safe_strncpy (BootFile, bp->bp_file, sizeof(BootFile)); debug ("Bootfile: %s\n", BootFile); @@ -564,7 +565,7 @@ BootpRequest (void) NetWriteIP(&bp->bp_siaddr, 0); NetWriteIP(&bp->bp_giaddr, 0); memcpy (bp->bp_chaddr, NetOurEther, 6); - copy_filename (bp->bp_file, BootFile, sizeof(bp->bp_file)); + safe_strncpy (bp->bp_file, BootFile, sizeof(bp->bp_file)); /* Request additional information from the BOOTP/DHCP server */ #ifdef CONFIG_NET_DHCP @@ -1490,19 +1490,6 @@ NetSetIP(uchar * xip, IPaddr_t dest, int dport, int sport, int len) ip->ip_sum = ~NetCksum((uchar *)ip, IP_HDR_SIZE_NO_UDP / 2); } -void copy_filename (char *dst, char *src, int size) -{ - if (*src && (*src == '"')) { - ++src; - --size; - } - - while ((--size > 0) && *src && (*src != '"')) { - *dst++ = *src++; - } - *dst = '\0'; -} - char *ip_to_string (IPaddr_t x, char *s) { x = ntohl (x); |