Fix strange jump issue

This commit is contained in:
Erik Ekman 2006-11-07 10:07:53 +00:00
parent aeae642fd8
commit 3f0dbf5ce5

4
read.c
View File

@ -24,7 +24,7 @@ readname_loop(char *packet, int packetlen, char **src, char *dst, size_t length,
char *s; char *s;
char *d; char *d;
int len; int len;
unsigned offset; int offset;
char c; char c;
if (loop <= 0) if (loop <= 0)
@ -38,7 +38,7 @@ readname_loop(char *packet, int packetlen, char **src, char *dst, size_t length,
/* is this a compressed label? */ /* is this a compressed label? */
if((c & 0xc0) == 0xc0) { if((c & 0xc0) == 0xc0) {
offset = (((s[-1] & 0x3f) << 8) | s[0]); offset = (((s[-1] & 0x3f) << 8) | (s[0] & 0xff));
if (offset > packetlen) { if (offset > packetlen) {
if (len == 0) { if (len == 0) {
// Bad jump first in packet // Bad jump first in packet