Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157641276
D21266.id60819.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D21266.id60819.diff
View Options
Index: sbin/ping6/ping6.c
===================================================================
--- sbin/ping6/ping6.c
+++ sbin/ping6/ping6.c
@@ -279,7 +279,7 @@
static void pr_nodeaddr(struct icmp6_nodeinfo *, int);
static int myechoreply(const struct icmp6_hdr *);
static int mynireply(const struct icmp6_nodeinfo *);
-static char *dnsdecode(const u_char *, const u_char *, const u_char *,
+static const char *dnsdecode(const u_char *, const u_char *, const u_char *,
char *, size_t);
static void pr_pack(u_char *, int, struct msghdr *);
static void pr_exthdrs(struct msghdr *);
@@ -1428,7 +1428,7 @@
return 0;
}
-static char *
+static const char *
dnsdecode(const u_char *sp, const u_char *ep, const u_char *base, char *buf,
size_t bufsiz)
/*base for compressed name*/
@@ -1484,8 +1484,7 @@
if (i != 0)
return NULL; /*not terminated*/
cp++;
- sp = cp;
- return buf;
+ return cp;
}
/*
@@ -1505,7 +1504,8 @@
int hoplim;
struct sockaddr *from;
int fromlen;
- u_char *cp = NULL, *dp, *end = buf + cc;
+ const u_char *cp = NULL;
+ u_char *dp, *end = buf + cc;
struct in6_pktinfo *pktinfo = NULL;
struct timespec tv, tp;
struct tv32 *tpp;
@@ -1677,9 +1677,10 @@
} else {
i = 0;
while (cp < end) {
- if (dnsdecode((const u_char *)cp, end,
+ cp = dnsdecode((const u_char *)cp, end,
(const u_char *)(ni + 1), dnsname,
- sizeof(dnsname)) == NULL) {
+ sizeof(dnsname));
+ if (cp == NULL) {
printf("???");
break;
}
@@ -2444,8 +2445,9 @@
}
printf(", subject=%s", niqcode[ni->ni_code]);
cp = (const u_char *)(ni + 1);
- if (dnsdecode(cp, end, NULL, dnsname,
- sizeof(dnsname)) != NULL)
+ cp = dnsdecode(cp, end, NULL, dnsname,
+ sizeof(dnsname));
+ if (cp != NULL)
printf("(%s)", dnsname);
else
printf("(invalid)");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 24, 3:58 PM (20 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33478383
Default Alt Text
D21266.id60819.diff (1 KB)
Attached To
Mode
D21266: ping6: Fix dnsdecode() bug introduced by r350859
Attached
Detach File
Event Timeline
Log In to Comment