diff --git a/libgnucash/engine/gnc-budget.c b/libgnucash/engine/gnc-budget.c index 16c121ed51..4da6cf1ba2 100644 --- a/libgnucash/engine/gnc-budget.c +++ b/libgnucash/engine/gnc-budget.c @@ -489,7 +489,7 @@ void gnc_budget_unset_account_period_value(GncBudget *budget, const Account *account, guint period_num) { - gchar path_part_one [GUID_ENCODING_LENGTH]; + gchar path_part_one [GUID_ENCODING_LENGTH + 1]; gchar path_part_two [GNC_BUDGET_MAX_NUM_PERIODS_DIGITS]; g_return_if_fail (budget != NULL); @@ -511,7 +511,7 @@ void gnc_budget_set_account_period_value(GncBudget *budget, const Account *account, guint period_num, gnc_numeric val) { - gchar path_part_one [GUID_ENCODING_LENGTH]; + gchar path_part_one [GUID_ENCODING_LENGTH + 1]; gchar path_part_two [GNC_BUDGET_MAX_NUM_PERIODS_DIGITS]; /* Watch out for an off-by-one error here: @@ -553,7 +553,7 @@ gnc_budget_is_account_period_value_set(const GncBudget *budget, guint period_num) { GValue v = G_VALUE_INIT; - gchar path_part_one [GUID_ENCODING_LENGTH]; + gchar path_part_one [GUID_ENCODING_LENGTH + 1]; gchar path_part_two [GNC_BUDGET_MAX_NUM_PERIODS_DIGITS]; gconstpointer ptr = NULL; @@ -573,7 +573,7 @@ gnc_budget_get_account_period_value(const GncBudget *budget, guint period_num) { gnc_numeric *numeric = NULL; - gchar path_part_one [GUID_ENCODING_LENGTH]; + gchar path_part_one [GUID_ENCODING_LENGTH + 1]; gchar path_part_two [GNC_BUDGET_MAX_NUM_PERIODS_DIGITS]; GValue v = G_VALUE_INIT; diff --git a/libgnucash/engine/guid.cpp b/libgnucash/engine/guid.cpp index 5706802f5b..11aaebf11d 100644 --- a/libgnucash/engine/guid.cpp +++ b/libgnucash/engine/guid.cpp @@ -177,7 +177,9 @@ guid_to_string_buff (const GncGUID * guid, gchar *str) gnc::GUID temp {*guid}; auto val = temp.to_string (); - /*We need to be sure to copy the terminating null character.*/ + /*We need to be sure to copy the terminating null character. + * The standard guarantees that std::basic_string::c_str () + * returns with a terminating null character, too.*/ std::copy (val.c_str (), val.c_str () + val.size () + 1, str); return str + val.size (); }