Skip to content

bug in test_httpauth_digest_response() #1330

@alfredh

Description

@alfredh

There are two bugs in this function:

		if (str_casecmp(resp->response,
			testv[i].precalc_digest) != 0) {
			err = EINVAL;
			DEBUG_WARNING("[%d]"
				" Expected response %s, got %w\n", i,
				testv[i].precalc_digest,
				resp->response, resp->hash_length);
			goto out;
		}
  1. the length of the string should also be checked
  2. actual response is printed using %w which is wrong (should use %s)

Example:

./test/retest -r -v test_httpauth_digest_response
single testcase: test_httpauth_digest_response
retest: libre version 3.22.0 (arm64/Darwin)
using async polling method 'kqueue'
using datapath './test/data'
regular tests:       httpauth: [1] Expected response d22b56ce81bbb59570f0fbbc0ba27210dbbfcb2b23fea371d214722f319dc41c, got 6332326235366365383162626235393537306630666262633062613237323130
test: test_httpauth_digest_response: test failed (Invalid argument [22])

retest: TEST_ERR: /Users/alfredh/git/re/test/main.c:237: (Invalid argument [22])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions