static const char out_table[32]="0123456789abcdefghijklmnopqrstuv";
static void dump_enc(struct dnsdomainenc *be, const char *what) {
- printf("ENC p=%08"PRIx32"/%-2d o=[%d]|%02x %s\n",
+ printf("ENC p=%08"PRIx32"/%-2d o=[%02d]|%02x %s\n",
be->pending, be->npending,
(int)(be->out - be->bufstop), *be->out,
what);
static void dump_dec(struct dnsdomaindec *bd, const char *what) {
int remain=bd->in - bd->databuf;
- printf("DEC4 i=[%d]|%02x p=%08"PRIx32"/%-2d %s\n",
+ printf("DEC4 i=[%02d]|%02x p=%08"PRIx32"/%-2d %s\n",
remain, remain ? *(bd->in-1) : 0,
bd->pending, bd->npending,
what);
for (;;) {
if (domain==endpacket)
return RCODE_FORMERR;
- printf("DEC1 dom=|%d|%02x[%d]\n", domain-packet,
+ printf("DEC1 dom=|[%02d]|%02x[%02d]\n", domain-packet,
*domain, endpacket-domain);
unsigned b=*domain++;
if (!b) {
/* must be enough input and enough space in pending */
dump_dec(bd,"inputchar 1");
int ch=*--(bd->in);
- bd->pending <<= 8;
- bd->pending |= ch; /* already decoded */
+ bd->pending |= (ch << bd->npending); /* already decoded */
bd->npending += 5;
dump_dec(bd,"inputchar 2");
}