Mercurial > projects > libpws
comparison pws-field.c @ 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 | d541e748cfd8 |
children | 96a507a110c8 |
comparison
equal
deleted
inserted
replaced
5:b3fc9f7e2b43 | 6:1c0e7f79e737 |
---|---|
197 } | 197 } |
198 if (t == NULL) { | 198 if (t == NULL) { |
199 return (-1); | 199 return (-1); |
200 } | 200 } |
201 field->value.text = t; | 201 field->value.text = t; |
202 field->size = len + 1; | 202 field->size = len; |
203 memcpy(field->value.text, s, field->size); | 203 memcpy(field->value.text, s, len + 1); |
204 | 204 |
205 return (0); | 205 return (0); |
206 } | 206 } |
207 | 207 |
208 int | 208 int |