diff 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
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);
 }