mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2024-12-22 04:38:55 +00:00
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().
This commit is contained in:
parent
6a99758928
commit
ea62c2dcda
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user