Index: enum.c =================================================================== RCS file: /usr/cvsroot/asterisk/enum.c,v retrieving revision 1.22 diff -u -r1.22 enum.c --- enum.c 2 Mar 2005 05:17:13 -0000 1.22 +++ enum.c 2 Mar 2005 06:43:48 -0000 @@ -263,14 +263,22 @@ printf("ENUMTXT Called\n"); #endif + if (answer == NULL) { c->txt = NULL; c->txtlen = 0; return 0; } - strncpy(c->txt, answer, sizeof(c->txt) - 1); - c->txt[sizeof(c->txt) - 1] = 0; /* Make sure the string is terminated */ - c->txtlen = strlen(c->txt); + + /* Skip first byte of TXT RDATA */ + answer += 1; + len -= 1; + + /* Answer has two unneeded bytes on the end as well */ + + strncpy(c->txt, answer, strlen(answer) - 2); + c->txt[strlen(answer) - 1] = "\0"; /* Make sure the string is terminated */ + c->txtlen = strlen(answer) - 2; return 1; }