mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 18:25:52 +08:00
Update to FreeBSD head 2018-02-01
Git mirror commit d079ae0442af8fa3cfd6d7ede190d04e64a2c0d4. Update #3472.
This commit is contained in:
@@ -157,15 +157,14 @@ ns_nprint(netdissect_options *ndo,
|
||||
register u_int i, l;
|
||||
register const u_char *rp = NULL;
|
||||
register int compress = 0;
|
||||
int chars_processed;
|
||||
int elt;
|
||||
int data_size = ndo->ndo_snapend - bp;
|
||||
u_int offset, max_offset;
|
||||
|
||||
if ((l = labellen(ndo, cp)) == (u_int)-1)
|
||||
return(NULL);
|
||||
if (!ND_TTEST2(*cp, 1))
|
||||
return(NULL);
|
||||
chars_processed = 1;
|
||||
max_offset = (u_int)(cp - bp);
|
||||
if (((i = *cp++) & INDIR_MASK) != INDIR_MASK) {
|
||||
compress = 0;
|
||||
rp = cp + l;
|
||||
@@ -180,24 +179,28 @@ ns_nprint(netdissect_options *ndo,
|
||||
}
|
||||
if (!ND_TTEST2(*cp, 1))
|
||||
return(NULL);
|
||||
cp = bp + (((i << 8) | *cp) & 0x3fff);
|
||||
offset = (((i << 8) | *cp) & 0x3fff);
|
||||
/*
|
||||
* This must move backwards in the packet.
|
||||
* No RFC explicitly says that, but BIND's
|
||||
* name decompression code requires it,
|
||||
* as a way of preventing infinite loops
|
||||
* and other bad behavior, and it's probably
|
||||
* what was intended (compress by pointing
|
||||
* to domain name suffixes already seen in
|
||||
* the packet).
|
||||
*/
|
||||
if (offset >= max_offset) {
|
||||
ND_PRINT((ndo, "<BAD PTR>"));
|
||||
return(NULL);
|
||||
}
|
||||
max_offset = offset;
|
||||
cp = bp + offset;
|
||||
if ((l = labellen(ndo, cp)) == (u_int)-1)
|
||||
return(NULL);
|
||||
if (!ND_TTEST2(*cp, 1))
|
||||
return(NULL);
|
||||
i = *cp++;
|
||||
chars_processed++;
|
||||
|
||||
/*
|
||||
* If we've looked at every character in
|
||||
* the message, this pointer will make
|
||||
* us look at some character again,
|
||||
* which means we're looping.
|
||||
*/
|
||||
if (chars_processed >= data_size) {
|
||||
ND_PRINT((ndo, "<LOOP>"));
|
||||
return (NULL);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ((i & INDIR_MASK) == EDNS0_MASK) {
|
||||
@@ -218,14 +221,12 @@ ns_nprint(netdissect_options *ndo,
|
||||
}
|
||||
|
||||
cp += l;
|
||||
chars_processed += l;
|
||||
ND_PRINT((ndo, "."));
|
||||
if ((l = labellen(ndo, cp)) == (u_int)-1)
|
||||
return(NULL);
|
||||
if (!ND_TTEST2(*cp, 1))
|
||||
return(NULL);
|
||||
i = *cp++;
|
||||
chars_processed++;
|
||||
if (!compress)
|
||||
rp += l + 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user