diff options
author | Daiki Ueno <dueno@src.gnome.org> | 2018-03-29 11:30:55 +0200 |
---|---|---|
committer | Daiki Ueno <dueno@src.gnome.org> | 2018-03-29 11:31:31 +0200 |
commit | ea62c2dcda82d6f84cfd99c155bea9a2b1040ea0 (patch) | |
tree | 87475f1c3a7e1d9a7dd1b06ce1f9e82db0b51467 /egg | |
parent | 6a9975892801c523bfd594b3003d7104b9e82a1a (diff) | |
download | libsecret-ea62c2dcda82d6f84cfd99c155bea9a2b1040ea0.tar.gz |
egg: Fix null termination behavior of egg_secure_strndup()
Even if the given string is shorter than n, the result should be null
terminated. This matches the behavior of strndup().
Diffstat (limited to 'egg')
-rw-r--r-- | egg/egg-secure-memory.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/egg/egg-secure-memory.c b/egg/egg-secure-memory.c index 8d320f1..bc82184 100644 --- a/egg/egg-secure-memory.c +++ b/egg/egg-secure-memory.c @@ -1344,6 +1344,7 @@ egg_secure_strndup_full (const char *tag, len = length + 1; res = (char *)egg_secure_alloc_full (tag, len, options); memcpy (res, str, len); + res[length] = '\0'; return res; } |