]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
src/cfg: fix iterating in clear_options, on the error path
authorAlexander Sosedkin <asosedkin@redhat.com>
Tue, 14 Apr 2026 16:21:19 +0000 (18:21 +0200)
committerAlexander Sosedkin <asosedkin@redhat.com>
Wed, 29 Apr 2026 14:26:23 +0000 (16:26 +0200)
Calling testing tools bundled with GnuTLS with malformed arguments
could lead to crashing them.
This change makes the error path of option parsing more robust.

Fixes: #1823
Reported-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Co-authored-by: Joshua Rogers of AISLE Research Team <joshua@joshua.hu>
Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
src/cfg.c

index 9a9627f180edb02dc571d8c922ef893854ead1be..47d2d6434cfbb72e8c4ace5653b0b085d277a1cf 100644 (file)
--- a/src/cfg.c
+++ b/src/cfg.c
@@ -370,7 +370,7 @@ static int take_option(struct options_st *options, struct cfg_option_st *option)
 
 static void clear_options(struct options_st *options)
 {
-       for (size_t i = 0; options->length; i++) {
+       for (size_t i = 0; i < options->length; i++) {
                clear_option(&options->data[i]);
        }
 }