|
@@ -222,18 +222,24 @@ static char * dns_qualify_name ( const char *string ) {
|
222
|
222
|
* DNS names consist of "<length>element" pairs.
|
223
|
223
|
*/
|
224
|
224
|
static char * dns_make_name ( const char *string, char *buf ) {
|
225
|
|
- char *length_byte = buf++;
|
|
225
|
+ char *length_byte;
|
226
|
226
|
char c;
|
227
|
227
|
|
228
|
|
- while ( ( c = *(string++) ) ) {
|
229
|
|
- if ( c == '.' ) {
|
230
|
|
- *length_byte = buf - length_byte - 1;
|
231
|
|
- length_byte = buf;
|
|
228
|
+ length_byte = buf++;
|
|
229
|
+ *length_byte = 0;
|
|
230
|
+ do {
|
|
231
|
+ c = *(string++);
|
|
232
|
+ if ( ( c == '.' ) || ( c == '\0' ) ) {
|
|
233
|
+ if ( *length_byte ) {
|
|
234
|
+ length_byte = buf++;
|
|
235
|
+ *length_byte = 0;
|
|
236
|
+ }
|
|
237
|
+ } else {
|
|
238
|
+ *(buf++) = c;
|
|
239
|
+ (*length_byte)++;
|
232
|
240
|
}
|
233
|
|
- *(buf++) = c;
|
234
|
|
- }
|
235
|
|
- *length_byte = buf - length_byte - 1;
|
236
|
|
- *(buf++) = '\0';
|
|
241
|
+ } while ( c );
|
|
242
|
+
|
237
|
243
|
return buf;
|
238
|
244
|
}
|
239
|
245
|
|