Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F96065213
D39125.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
919 B
Referenced Files
None
Subscribers
None
D39125.id.diff
View Options
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1670,7 +1670,7 @@
int hlen;
hlen = ip->ip_hl << 2;
- cp = (u_char *)ip + 20; /* point to options */
+ cp = (u_char *)ip + sizeof(struct ip); /* point to options */
(void)printf("Vr HL TOS Len ID Flg off TTL Pro cks Src Dst\n");
(void)printf(" %1x %1x %02x %04x %04x",
@@ -1686,7 +1686,7 @@
memcpy(&ina, &ip->ip_dst.s_addr, sizeof ina);
(void)printf(" %s ", inet_ntoa(ina));
/* dump any option bytes */
- while (hlen-- > 20) {
+ while (hlen-- > (int)sizeof(struct ip)) {
(void)printf("%02x", *cp++);
}
(void)putchar('\n');
@@ -1706,7 +1706,7 @@
if (options & F_NUMERIC)
return inet_ntoa(ina);
- hp = cap_gethostbyaddr(capdns, (char *)&ina, 4, AF_INET);
+ hp = cap_gethostbyaddr(capdns, (char *)&ina, sizeof(ina), AF_INET);
if (hp == NULL)
return inet_ntoa(ina);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 24, 1:34 PM (8 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
12666861
Default Alt Text
D39125.id.diff (919 B)
Attached To
Mode
D39125: ping: Avoid magic numbers
Attached
Detach File
Event Timeline
Log In to Comment