Skip to contentSkip to conversation

libkmod: reset was_space on second pass

PATCH Applied Lucas De Marchi 2 participants 3 messages Jan 20, 2020 – Jan 28, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libkmod: reset was_space on second pass

From: Lucas De Marchi <[email protected]>

The softdep config parser uses a 2-pass approach to use a single allocation for all the softdep struct. However "was_space" variable isn't reset between them. This can lead to a buffer overflow.

---
 libkmod/libkmod-config.c | 1 +
 1 file changed, 1 insertion(+)
libkmod/libkmod-config.c +1 -0
index aaac0a1..7b62367 100644
@@ -335,6 +335,7 @@ static int kmod_config_add_softdep(struct kmod_config *config,
 	n_pre = 0;
 	n_post = 0;
 	mode = S_NONE;
+	was_space = false;
 	for (p = s = line; ; s++) {
 		size_t plen;
 
Signature · 1 line
2.24.1
author Applied
#1 lore raw
Quoted 10 lines · Lucas De Marchi

From: Lucas De Marchi <[email protected]>

The softdep config parser uses a 2-pass approach to use a single allocation for all the softdep struct. However "was_space" variable isn't reset between them. This can lead to a buffer overflow.

---

Applied,

Lucas De Marchi

Quoted 18 lines
 libkmod/libkmod-config.c | 1 +
 1 file changed, 1 insertion(+)
libkmod/libkmod-config.c +1 -1
index aaac0a1..7b62367 100644
@@ -335,6 +335,7 @@ static int kmod_config_add_softdep(struct kmod_config *config,
        n_pre = 0;
        n_post = 0;
        mode = S_NONE;
+       was_space = false;
        for (p = s = line; ; s++) {
                size_t plen;
 
--

2.24.1

Signature · 1 line
Lucas De Marchi
#2 lore raw

Thanks!

Quoted 40 lines · Lucas De Marchi
Quoted 10 lines · Lucas De Marchi

From: Lucas De Marchi <[email protected]>

The softdep config parser uses a 2-pass approach to use a single allocation for all the softdep struct. However "was_space" variable isn't reset between them. This can lead to a buffer overflow.

---

Applied,

Lucas De Marchi

Quoted 16 lines
 libkmod/libkmod-config.c | 1 +
 1 file changed, 1 insertion(+)
libkmod/libkmod-config.c +1 -1
index aaac0a1..7b62367 100644
@@ -335,6 +335,7 @@ static int kmod_config_add_softdep(struct kmod_config *config,
        n_pre = 0;
        n_post = 0;
        mode = S_NONE;
+       was_space = false;
        for (p = s = line; ; s++) {
                size_t plen;
 
--
Quoted 2 lines

2.24.1

--
Lucas De Marchi