elog string hashtable use strlen() to determine string length for
hashing, strings must be NULL-terminated for both inserts and lookups.
Type: fix
Fixes:
9c8ca8dd3197e40dfcb8bcecd95c10eeb56239ed
Change-Id: I0680d39a9b89411055fd6adc89c9f253adfae32c
Signed-off-by: Benoît Ganne <bganne@cisco.com>
em->string_table_tmp = va_format (em->string_table_tmp, fmt, &va);
va_end (va);
em->string_table_tmp = va_format (em->string_table_tmp, fmt, &va);
va_end (va);
+ /* String table entries MUST be NULL terminated */
+ len = vec_len (em->string_table_tmp);
+ ASSERT (len > 0);
+ if (em->string_table_tmp[len - 1] != 0)
+ vec_add1 (em->string_table_tmp, 0);
+
/* See if we already have this string in the string table */
p = hash_get_mem (em->string_table_hash, em->string_table_tmp);
/* See if we already have this string in the string table */
p = hash_get_mem (em->string_table_hash, em->string_table_tmp);
- /* We don't, so add it. String table entries MUST be NULL terminated */
- len = vec_len (em->string_table_tmp);
- ASSERT (len > 0);
- if (em->string_table_tmp[len - 1] != 0)
- vec_add1 (em->string_table_tmp, 0);
+ /* We don't, so add it. */
offset = vec_len (em->string_table);
vec_append (em->string_table, em->string_table_tmp);
offset = vec_len (em->string_table);
vec_append (em->string_table, em->string_table_tmp);