diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2019-01-04 18:59:14 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2019-01-04 18:59:14 (GMT) |
commit | e827eb8bdc797d2a8c194e675bd300e97aee6166 (patch) | |
tree | aee7f9186f9e20eab24c20dd2cd0ba01d4f874e2 /src/gui | |
parent | b9fe3a839e9212b809d64c11bf92b703adb18fb2 (diff) |
Handled non null-terminated strings
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/panels/strings.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c index 5bba0ca..8814c0b 100644 --- a/src/gui/panels/strings.c +++ b/src/gui/panels/strings.c @@ -745,7 +745,9 @@ static void reload_strings_for_new_list_view(const GStringsPanel *panel, GtkStat VMPA_BUFFER(virt); /* Adresse virtuelle */ GBinPortion *portion; /* Zone mémoire d'appartenance */ const char *area; /* Description de la zone */ + size_t len; /* Taille de la chaîne */ const char *text; /* Texte original référencé */ + char *real_text; /* Texte avec octet nul final */ GtkTreeIter iter; /* Point d'insertion */ builder = G_PANEL_ITEM(panel)->builder; @@ -779,9 +781,11 @@ static void reload_strings_for_new_list_view(const GStringsPanel *panel, GtkStat area = g_binary_portion_get_desc(portion); g_object_unref(G_OBJECT(portion)); - text = g_string_symbol_get_utf8(G_STR_SYMBOL(symbol)); + text = g_string_symbol_get_utf8(G_STR_SYMBOL(symbol), &len); if (text == NULL) goto rsfnlv_next; + real_text = strndup(text, len); + gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, STC_SYMBOL, symbol, @@ -790,10 +794,12 @@ static void reload_strings_for_new_list_view(const GStringsPanel *panel, GtkStat STC_AREA, area, STC_NAME, NULL, STC_VALUE, NULL, - STC_ORIGINAL, text, + STC_ORIGINAL, real_text, STC_MATCHED, false, -1); + free(real_text); + update_string_node(data, store, &iter); data->count++; |