mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-10 20:50:00 -04:00
fix: test: Fix strstr const inheritance issue in test code
The const property was discarded by a strstr call in test-data.c. This has been fixed. Closes #5861 Merge branch '5861-fix-const-inheritance-issue-in-test' into 'bind-9.20' See merge request isc-projects/bind9!11815
This commit is contained in:
commit
dbfc344e63
1 changed files with 11 additions and 7 deletions
|
|
@ -865,8 +865,8 @@ apply_update(const char *updstr, trpz_result_t **presults, size_t *pnresults,
|
|||
}
|
||||
|
||||
} else if (!strcasecmp(rrbuf, "TXT")) {
|
||||
char *ftext = NULL;
|
||||
|
||||
const char *ftext = NULL;
|
||||
size_t len;
|
||||
ftext = strstr(updstr, databuf);
|
||||
if (ftext == NULL) {
|
||||
fprintf(stderr, "Error parsing TXT record: \"%s\"\n",
|
||||
|
|
@ -875,15 +875,19 @@ apply_update(const char *updstr, trpz_result_t **presults, size_t *pnresults,
|
|||
}
|
||||
|
||||
if (*ftext == '"') {
|
||||
*ftext++ = 0;
|
||||
ftext++;
|
||||
|
||||
if (ftext[strlen(ftext) - 1] == '"') {
|
||||
ftext[strlen(ftext) - 1] = 0;
|
||||
len = strlen(ftext);
|
||||
if (len > 0 && ftext[len - 1] == '"') {
|
||||
len--;
|
||||
}
|
||||
} else {
|
||||
len = strlen(ftext);
|
||||
}
|
||||
|
||||
strncpy(databuf, ftext, sizeof(databuf));
|
||||
databuf[sizeof(databuf) - 1] = 0;
|
||||
strncpy(databuf, ftext,
|
||||
len < sizeof(databuf) ? len : sizeof(databuf));
|
||||
databuf[len < sizeof(databuf) ? len : sizeof(databuf) - 1] = 0;
|
||||
policy = LIBRPZ_POLICY_RECORD;
|
||||
} else if (!strcasecmp(rrbuf, "DNAME")) {
|
||||
policy = LIBRPZ_POLICY_RECORD;
|
||||
|
|
|
|||
Loading…
Reference in a new issue