[PATCH 2/3] Terminate the string before relying on strlen

Anton Lundin glance at acc.umu.se
Tue May 6 15:27:50 PDT 2014


Its a c-string we put, so it must be null-terminated.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 save-xml.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/save-xml.c b/save-xml.c
index 54a0a86..227b952 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -191,7 +191,7 @@ static void show_location(struct membuffer *b, struct dive *dive)
 
 		len += format_location(buffer + len, latitude, longitude);
 		if (!dive->location) {
-			memcpy(buffer + len, "/>\n", 4);
+			memcpy(buffer + len, "/>\n\0", 5);
 			put_string(b, buffer);
 			return;
 		}
-- 
1.9.1



More information about the subsurface mailing list