From: Aki Tuomi Date: Wed, 27 Sep 2023 07:31:28 +0000 (+0300) Subject: lib-oauth2: test-oauth2-json - Increment pos more carefully X-Git-Tag: 2.4.0~2571 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e788cd32b92ac19b23c522505695f047155bbf3;p=thirdparty%2Fdovecot%2Fcore.git lib-oauth2: test-oauth2-json - Increment pos more carefully --- diff --git a/src/lib-oauth2/test-oauth2-json.c b/src/lib-oauth2/test-oauth2-json.c index 121b8a1065..3e50931b2f 100644 --- a/src/lib-oauth2/test-oauth2-json.c +++ b/src/lib-oauth2/test-oauth2-json.c @@ -75,10 +75,10 @@ static void test_oauth2_json_valid(void) cb_got_called = FALSE; /* Parse the JSON response */ - for (pos = 0; pos <= strlen(test_input); pos +=2) { + for (pos = 0;; pos += 2) { test_istream_set_size(req->is, pos); oauth2_request_parse_json(req); - if (req->is == NULL) + if (pos >= strlen(test_input)) break; } @@ -130,10 +130,10 @@ static void test_oauth2_json_error(void) cb_got_called = FALSE; /* Parse the JSON response */ - for (size_t pos = 0; pos <= strlen(test_input_1); pos +=2) { + for (size_t pos = 0;; pos += 2) { test_istream_set_size(req->is, pos); oauth2_request_parse_json(req); - if (req->is == NULL) + if (pos >= strlen(test_input_1)) break; } @@ -151,10 +151,10 @@ static void test_oauth2_json_error(void) cb_got_called = FALSE; /* Parse the JSON response */ - for (size_t pos = 0; pos <= strlen(test_input_2); pos +=2) { + for (size_t pos = 0;; pos += 2) { test_istream_set_size(req->is, pos); oauth2_request_parse_json(req); - if (req->is == NULL) + if (pos >= strlen(test_input_2)) break; }