--- pdns_recursor.cc~orig 2006-11-11 21:59:06.000000000 +0100 +++ pdns_recursor.cc 2006-11-11 21:59:49.000000000 +0100 @@ -562,7 +562,7 @@ if(bytes==1) i->state=TCPConnection::BYTE1; if(bytes==2) { - i->qlen=(i->data[0]<<8)+i->data[1]; + i->qlen=(((unsigned char)i->data[0]<<8)) + (unsigned char)i->data[1]; i->bytesread=0; i->state=TCPConnection::GETQUESTION; } @@ -576,7 +576,7 @@ int bytes=read(i->fd,i->data+1,1); if(bytes==1) { i->state=TCPConnection::GETQUESTION; - i->qlen=(i->data[0]<<8)+i->data[1]; + i->qlen=(((unsigned char)i->data[0]<<8)) + (unsigned char)i->data[1]; i->bytesread=0; } if(!bytes || bytes < 0) {