]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Address infinite loop on EOF.
authorMark Andrews <marka@isc.org>
Thu, 13 Aug 2020 06:42:40 +0000 (16:42 +1000)
committerMark Andrews <marka@isc.org>
Thu, 13 Aug 2020 06:42:40 +0000 (16:42 +1000)
fuzz/isc_lex_getmastertoken.c

index a9beb7d681dff0d2c453a49e62677817ba8dd567..2649dd0cfbf9ef2521d6bab5d0109ddf1e93446d 100644 (file)
@@ -47,6 +47,7 @@ int
 LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
        isc_buffer_t buf;
        isc_result_t result;
+       isc_token_t token;
        isc_tokentype_t expect;
        bool eol;
 
@@ -69,9 +70,8 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
        CHECK(isc_lex_openbuffer(lex, &buf));
 
        do {
-               isc_token_t token;
                result = isc_lex_getmastertoken(lex, &token, expect, eol);
-       } while (result == ISC_R_SUCCESS);
+       } while (result == ISC_R_SUCCESS && token.type != isc_tokentype_eof);
 
        return (0);
 }