Mercurial > projects > libpws
changeset 6:1c0e7f79e737
Fix incorrect field size for text fields
The field size should be the string length excluding the terminating null byte
which is there for convenience only when using the C API and not part of the
on-disk format.
author | Guido Berhoerster <guido+libpws@berhoerster.name> |
---|---|
date | Thu, 10 Jan 2019 09:35:16 +0100 |
parents | b3fc9f7e2b43 |
children | 7fd61c245bbd |
files | pws-field.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pws-field.c Thu Jan 10 08:05:32 2019 +0100 +++ b/pws-field.c Thu Jan 10 09:35:16 2019 +0100 @@ -199,8 +199,8 @@ return (-1); } field->value.text = t; - field->size = len + 1; - memcpy(field->value.text, s, field->size); + field->size = len; + memcpy(field->value.text, s, len + 1); return (0); }