File: fix-memory-overflow-access

package info (click to toggle)
bacula 9.6.7-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 25,020 kB
  • sloc: ansic: 157,001; cpp: 28,065; sh: 25,037; makefile: 4,384; perl: 3,433; sql: 1,371; python: 125; xml: 64; awk: 51; sed: 25
file content (20 lines) | stat: -rw-r--r-- 671 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Description: alist: Fix for memory overflow access.
Author: Radosław Korzeniewski <radekk@inteos.pl>
Last-Update: 2020-12-24
Forwarded: not-needed

Upstream commit 5ce0d3ff70d34dd05bb303d3d696f31c1785960c

diff --git a/src/lib/alist.c b/src/lib/alist.c
index 30914152c..81f60aba7 100644
--- a/src/lib/alist.c
+++ b/src/lib/alist.c
@@ -183,7 +183,7 @@ void * baselist::remove_item(int index)
 /* Get the index item -- we should probably allow real indexing here */
 void * baselist::get(int index)
 {
-   if (items == NULL || index < 0 || index > last_item) {
+   if (items == NULL || index < 0 || index >= last_item) {
       return NULL;
    }
    return items[index];