diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-11-06 16:20:21 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-11-11 10:08:08 +0100 |
commit | 66659ff1ad6831b0ea7425fa6ecd8a8687523658 (patch) | |
tree | 48e22b475fa8854128e0861a33fed6f78c8094b5 /freebsd/sbin/dhclient | |
parent | Define __GLOBL1() and __GLOBL() (diff) | |
download | rtems-libbsd-66659ff1ad6831b0ea7425fa6ecd8a8687523658.tar.bz2 |
Update to FreeBSD 9.2
Diffstat (limited to 'freebsd/sbin/dhclient')
-rw-r--r-- | freebsd/sbin/dhclient/clparse.c | 6 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/packet.c | 2 | ||||
-rw-r--r-- | freebsd/sbin/dhclient/parse.c | 12 |
3 files changed, 13 insertions, 7 deletions
diff --git a/freebsd/sbin/dhclient/clparse.c b/freebsd/sbin/dhclient/clparse.c index 7fb278dd..b52bc473 100644 --- a/freebsd/sbin/dhclient/clparse.c +++ b/freebsd/sbin/dhclient/clparse.c @@ -875,6 +875,7 @@ parse_string_list(FILE *cfile, struct string_list **lp, int multiple) { int token; char *val; + size_t valsize; struct string_list *cur, *tmp; /* Find the last medium in the media list. */ @@ -892,10 +893,11 @@ parse_string_list(FILE *cfile, struct string_list **lp, int multiple) return; } - tmp = new_string_list(strlen(val) + 1); + valsize = strlen(val) + 1; + tmp = new_string_list(valsize); if (tmp == NULL) error("no memory for string list entry."); - strlcpy(tmp->string, val, strlen(val) + 1); + memcpy(tmp->string, val, valsize); tmp->next = NULL; /* Store this medium at the end of the media list. */ diff --git a/freebsd/sbin/dhclient/packet.c b/freebsd/sbin/dhclient/packet.c index f5366d3c..e4fa0e86 100644 --- a/freebsd/sbin/dhclient/packet.c +++ b/freebsd/sbin/dhclient/packet.c @@ -130,7 +130,7 @@ assemble_udp_ip_header(unsigned char *buf, int *bufix, u_int32_t from, ip.ip_len = htons(sizeof(ip) + sizeof(udp) + len); ip.ip_id = 0; ip.ip_off = 0; - ip.ip_ttl = 16; + ip.ip_ttl = 128; ip.ip_p = IPPROTO_UDP; ip.ip_sum = 0; ip.ip_src.s_addr = from; diff --git a/freebsd/sbin/dhclient/parse.c b/freebsd/sbin/dhclient/parse.c index 5996ca36..19d407ea 100644 --- a/freebsd/sbin/dhclient/parse.c +++ b/freebsd/sbin/dhclient/parse.c @@ -118,6 +118,7 @@ char * parse_string(FILE *cfile) { char *val, *s; + size_t valsize; int token; token = next_token(&val, cfile); @@ -126,10 +127,11 @@ parse_string(FILE *cfile) skip_to_semi(cfile); return (NULL); } - s = malloc(strlen(val) + 1); + valsize = strlen(val) + 1; + s = malloc(valsize); if (!s) error("no memory for string %s.", val); - strlcpy(s, val, strlen(val) + 1); + memcpy(s, val, valsize); if (!parse_semi(cfile)) return (NULL); @@ -244,6 +246,7 @@ parse_numeric_aggregate(FILE *cfile, unsigned char *buf, int *max, unsigned char *bufp = buf, *s = NULL; int token, count = 0; char *val, *t; + size_t valsize; pair c = NULL; if (!bufp && *max) { @@ -290,10 +293,11 @@ parse_numeric_aggregate(FILE *cfile, unsigned char *buf, int *max, convert_num(s, val, base, size); s += size / 8; } else { - t = malloc(strlen(val) + 1); + valsize = strlen(val) + 1; + t = malloc(valsize); if (!t) error("no temp space for number."); - strlcpy(t, val, strlen(val) + 1); + memcpy(t, val, valsize); c = cons(t, c); } } while (++count != *max); |