summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dive.c2
-rw-r--r--save-git.c2
-rw-r--r--save-xml.c2
3 files changed, 4 insertions, 2 deletions
diff --git a/dive.c b/dive.c
index 56c0de0ec..78ad25532 100644
--- a/dive.c
+++ b/dive.c
@@ -2720,6 +2720,8 @@ void set_save_userid_local(short value)
void set_userid(char *rUserId)
{
prefs.userid = strdup(rUserId);
+ if (strlen(prefs.userid) > 30)
+ prefs.userid[30]='\0';
}
int average_depth(struct diveplan *dive)
diff --git a/save-git.c b/save-git.c
index 288917a29..8cde454f2 100644
--- a/save-git.c
+++ b/save-git.c
@@ -754,7 +754,7 @@ static void save_userid(void *_b)
{
struct membuffer *b = _b;
if (prefs.save_userid_local)
- put_format(b, "userid %30s", prefs.userid);
+ put_format(b, "userid %30s\n", prefs.userid);
}
static void save_one_device(void *_b, const char *model, uint32_t deviceid,
diff --git a/save-xml.c b/save-xml.c
index cf7ccfec7..c9adf5307 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -520,7 +520,7 @@ void save_dives_buffer(struct membuffer *b, const bool select_only)
put_format(b, "<divelog program='subsurface' version='%d'>\n<settings>\n", VERSION);
if (prefs.save_userid_local)
- put_format(b, " <userid>%s</userid>\n", prefs.userid);
+ put_format(b, " <userid>%30s</userid>\n", prefs.userid);
/* save the dive computer nicknames, if any */
call_for_each_dc(b, save_one_device);