diff options
| author | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2026-03-02 17:40:45 +0100 |
|---|---|---|
| committer | Jonathan Corbet <corbet@lwn.net> | 2026-03-03 10:47:24 -0700 |
| commit | 8eb49357ffa229c9b65a002f655c1280dc09769a (patch) | |
| tree | cf59df7b0dda3f35e7edfe33cfa0976659597dc5 /tools/lib/python/kdoc | |
| parent | 2b144a30a407d29b7e6d24549f5316175115e788 (diff) | |
docs: kdoc_re: don't go past the end of a line
The logic which checks if the line ends with ";" is currently
broken: it may try to read past the buffer.
Fix it by checking before trying to access line[pos].
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <bce51ba0260a053a0ec55a7375d6ed7a7c08026c.1772469446.git.mchehab+huawei@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc')
| -rw-r--r-- | tools/lib/python/kdoc/kdoc_re.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/python/kdoc/kdoc_re.py b/tools/lib/python/kdoc/kdoc_re.py index 774dd747ecb02..6c44fcce04156 100644 --- a/tools/lib/python/kdoc/kdoc_re.py +++ b/tools/lib/python/kdoc/kdoc_re.py @@ -269,7 +269,7 @@ class NestedMatch: out += new_sub # Drop end ';' if any - if line[pos] == ';': + if pos < len(line) and line[pos] == ';': pos += 1 cur_pos = pos |
