From 3e788cd32b92ac19b23c522505695f047155bbf3 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Wed, 27 Sep 2023 10:31:28 +0300 Subject: [PATCH] lib-oauth2: test-oauth2-json - Increment pos more carefully --- src/lib-oauth2/test-oauth2-json.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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; } -- 2.47.3