Skip to contentSkip to conversation

kconfig: fix bug in search results string: use strlen(gstr->s), not gstr->len

PATCH In review Martin Walch 3 participants 3 messages Oct 3, 2013 – Oct 7, 2013

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

PATCH v2 5/5 kconfig: fix bug in search results string: use strlen(gstr->s), not gstr->len

From: Martin Walch <[email protected]>
Date: Thu, 3 Oct 2013 18:35:16 +0200
Subject: [PATCH v2 5/5] kconfig: fix bug in search results string: use strlen(gstr->s), not gstr->len

The struct gstr has a capacity that may differ from the actual string length.

However, a string manipulation in the function search_conf made the assumption that it is the same, which led to messing up some search results, especially when the content of the gstr in use had not yet reached at least 63 chars.

---
 scripts/kconfig/menu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/menu.c +1 -1
index 9e69f19..db1512a 100644
@@ -584,7 +584,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
 		for (j = 4; --i >= 0; j += 2) {
 			menu = submenu[i];
 			if (head && location && menu == location)
-				jump->offset = r->len - 1;
+				jump->offset = strlen(r->s);
 			str_printf(r, "%*c-> %s", j, ' ',
 				   _(menu_get_prompt(menu)));
 			if (menu->sym) {
Signature · 1 line
1.8.1.5
Acked-by on v2 5/5
#1 lore raw
Quoted 11 lines · Martin Walch

From: Martin Walch <[email protected]>
Date: Thu, 3 Oct 2013 18:35:16 +0200
Subject: [PATCH v2 5/5] kconfig: fix bug in search results string: use strlen(gstr->s), not gstr->len

The struct gstr has a capacity that may differ from the actual string length.

However, a string manipulation in the function search_conf made the assumption that it is the same, which led to messing up some search results, especially when the content of the gstr in use had not yet reached at least 63 chars.

Thanks.