Commit 79333a24 authored by Giovanni Bajo's avatar Giovanni Bajo Committed by Simon Kelley

Fix a bug in extract_name_no_compression.

When the maxlen was exactly equal to the length of the string,
the function was returning 0 because the end-of-buffer check was
misplaced.
parent 32f82c62
...@@ -42,16 +42,16 @@ static int extract_name_no_compression(unsigned char *rr, int maxlen, char *buf) ...@@ -42,16 +42,16 @@ static int extract_name_no_compression(unsigned char *rr, int maxlen, char *buf)
if (*buf >= 'A' && *buf <= 'Z') if (*buf >= 'A' && *buf <= 'Z')
*buf += 'a' - 'A'; *buf += 'a' - 'A';
buf++; buf++;
} }
*buf++ = '.'; *buf++ = '.';
} }
// Remove trailing dot (if any) // Remove trailing dot (if any)
if (rr != start) if (rr != start)
*(--buf) = 0; *(--buf) = 0;
rr++;
if (rr == end) if (rr == end)
return 0; return 0;
return rr-start; // Trailing \0 in source data must be consumed
return rr-start+1;
} }
/* Check whether today/now is between date_start and date_end */ /* Check whether today/now is between date_start and date_end */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment