diff options
author | bpc2003 <wpesfriendnva@gmail.com> | 2025-03-17 14:54:25 -0400 |
---|---|---|
committer | bpc2003 <wpesfriendnva@gmail.com> | 2025-03-17 14:54:25 -0400 |
commit | 67124b97b3af69af0e2eeb82bb751a909f99b245 (patch) | |
tree | 347cb08dffa45a4990681a11faf06119ac787f15 /src/lib/keytab.c | |
parent | f8ad5a7a313070111e9a47195f738740146f71ed (diff) |
Added extra guard clauses to prevent undefined behavior
Diffstat (limited to 'src/lib/keytab.c')
-rw-r--r-- | src/lib/keytab.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/keytab.c b/src/lib/keytab.c index c2842c9..ff32e42 100644 --- a/src/lib/keytab.c +++ b/src/lib/keytab.c @@ -12,6 +12,8 @@ static char **getkv(char *pair); int *getkeys(tablist_t *list, int id) { int len = 2; + if (id >= list[0].len) + return NULL; int *indexes = calloc(len, sizeof(int)); for (int i = 0, j = 0; i < TABLEN; ++i) { if (j >= len) { |