From: "Lubomir I. Ivanov" <[email protected]>

In add_plan_to_notes() the 'disclaimer' is set to the temporary
buffer 'buf'. By making 'buf' static, 'disclaimer' now points to a
persistent buffer.

Bug was reported as bad characters when printing the planner
deco text.

Reported-by: Stefan Fuchs <[email protected]>
Signed-off-by: Lubomir I. Ivanov <[email protected]>
---
 subsurface-core/planner.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/subsurface-core/planner.c b/subsurface-core/planner.c
index 22d3716..9c8b9e9 100644
--- a/subsurface-core/planner.c
+++ b/subsurface-core/planner.c
@@ -534,7 +534,8 @@ static void add_plan_to_notes(struct diveplan *diveplan, 
struct dive *dive, bool
        const unsigned int sz_temp = 100000;
        char *buffer = (char *)malloc(sz_buffer);
        char *temp = (char *)malloc(sz_temp);
-       char buf[1000], *deco;
+       char *deco;
+       static char buf[1000];
        int len, lastdepth = 0, lasttime = 0, lastsetpoint = -1, newdepth = 0, 
lastprintdepth = 0, lastprintsetpoint = -1;
        struct gasmix lastprintgasmix = {{ -1 }, { -1 }};
        struct divedatapoint *dp = diveplan->dp;
-- 
1.7.11.msysgit.0

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to