gnucash maint: Provide static strings for gnc_userdata_home and gnc_userconfig_home.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

gnucash maint: Provide static strings for gnc_userdata_home and gnc_userconfig_home.

John Ralls-4
Updated via  https://github.com/Gnucash/gnucash/commit/c091197f (commit)
        from  https://github.com/Gnucash/gnucash/commit/6e7a4ccc (commit)



commit c091197f572a701cb2ecc81c40fe47bbd41f59aa
Author: John Ralls <[hidden email]>
Date:   Thu Apr 11 17:25:40 2019 -0700

    Provide static strings for gnc_userdata_home and gnc_userconfig_home.
   
    On Windows boost::filesystem::path's string() produces a string
    that goes out of scope with the function in which it's called, so
    returning its c_str() ptr yields freed memory, usually full of garbage.
   
    This has an interesting side effect in gnc-file.c's check_file_path():
    Since the memory is freed, g_path_get_dirname() reuses it after an
    iteration or two, writing its result into the same address. The
    following strcmp naturally returns 0 because it's comparing two
    instances of the same ptr, so check_file_path falsely reports that
    the proposed save path is in GNC_USERDATA_DIR.



Summary of changes:
 libgnucash/core-utils/gnc-filepath-utils.cpp | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

_______________________________________________
gnucash-patches mailing list
[hidden email]
https://lists.gnucash.org/mailman/listinfo/gnucash-patches