Skip to content

Fix use of uninitialized value

Pekka Ristola requested to merge pekkarr/zathura:fix-uninitialized-value into develop

Contents of string content are unitialized before copying of dummy_content. Using g_strlcat appends dummy_content to the uninitialized junk, and by changing that to strcpy the uninitialized values aren't used.

Relevant Valgrind error when running zathura with no arguments:

==15845== Conditional jump or move depends on uninitialised value(s)
==15845==    at 0x566EB2D: UnknownInlinedFun (gstrfuncs.c:1534)
==15845==    by 0x566EB2D: g_strlcat (gstrfuncs.c:1521)
==15845==    by 0x12B16D: zathura_db_read_key_file_from_file (database-plain.c:171)
==15845==    by 0x12D39D: UnknownInlinedFun (database-plain.c:295)
==15845==    by 0x12D39D: plain_set_property (database-plain.c:371)
==15845==    by 0x55C17AD: object_set_property (gobject.c:1607)
==15845==    by 0x55C1C1C: g_object_new_internal (gobject.c:2047)
==15845==    by 0x55C3307: g_object_new_valist (gobject.c:2355)
==15845==    by 0x55C383D: g_object_new (gobject.c:1824)
==15845==    by 0x117944: UnknownInlinedFun (database-plain.c:226)
==15845==    by 0x117944: init_database (zathura.c:373)
==15845==    by 0x11B8EA: zathura_init (zathura.c:473)
==15845==    by 0x114B99: UnknownInlinedFun (main.c:111)
==15845==    by 0x114B99: main (main.c:282)

Merge request reports