Skip to contentSkip to conversation

kconfig: qconf: fix buffer overflow in debug links

PATCH In review Masahiro Yamada 1 participant 2 messages Oct 1, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kconfig: qconf: fix buffer overflow in debug links

If you enable the "Option -> Show Debug Info" and click a click, the program terminates with the following error:

*** buffer overflow detected ***: terminated

The buffer overflow is caused by the following line:

    strcat(data, "$");

The buffer needs one more byte to accommodate the additional character.

Fixes c4f7398bee9c ("kconfig: qconf: make debug links work again")

---

 scripts/kconfig/qconf.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/qconf.cc +1 -1
index 7dba8014ead4..e260cab1c2af 100644
@@ -1166,7 +1166,7 @@ void ConfigInfoView::clicked(const QUrl &url)
 {
 	QByteArray str = url.toEncoded();
 	const std::size_t count = str.size();
-	char *data = new char[count + 1];
+	char *data = new char[count + 2];  // '$' + '\0'
 	struct symbol **result;
 	struct menu *m = NULL;
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 2 lines · Masahiro Yamada

If you enable the "Option -> Show Debug Info" and click a click, the

I meant "click a link"

Quoted 33 lines

program terminates with the following error:

*** buffer overflow detected ***: terminated

The buffer overflow is caused by the following line:

    strcat(data, "$");

The buffer needs one more byte to accommodate the additional character.

Fixes c4f7398bee9c ("kconfig: qconf: make debug links work again")

---

 scripts/kconfig/qconf.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/qconf.cc +1 -2
index 7dba8014ead4..e260cab1c2af 100644
@@ -1166,7 +1166,7 @@ void ConfigInfoView::clicked(const QUrl &url)
 {
        QByteArray str = url.toEncoded();
        const std::size_t count = str.size();
-       char *data = new char[count + 1];
+       char *data = new char[count + 2];  // '$' + '\0'
        struct symbol **result;
        struct menu *m = NULL;
 
--

2.43.0

Signature · 2 lines
Best Regards
Masahiro Yamada