changeset 23005:028036ddbb25

lib-storage: Fix buffer overflow when reading oversized hdr-pop3-uidl header
author Timo Sirainen <timo.sirainen@open-xchange.com>
date Mon, 04 Feb 2019 19:23:02 -0800
parents 168f4e3a2a53
children 0cf75c25fd26
files src/lib-storage/index/index-pop3-uidl.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-pop3-uidl.c	Wed Jan 16 18:28:57 2019 +0200
+++ b/src/lib-storage/index/index-pop3-uidl.c	Mon Feb 04 19:23:02 2019 -0800
@@ -37,7 +37,7 @@
 		/* this header isn't set yet */
 		return TRUE;
 	}
-	memcpy(&uidl, data, size);
+	memcpy(&uidl, data, sizeof(uidl));
 	return mail->uid <= uidl.max_uid_with_pop3_uidl;
 }
 
@@ -95,7 +95,7 @@
 
 	/* check if we have already the same header */
 	if (size >= sizeof(uidl)) {
-		memcpy(&uidl, data, size);
+		memcpy(&uidl, data, sizeof(uidl));
 		if (trans->highest_pop3_uidl_uid == uidl.max_uid_with_pop3_uidl)
 			return;
 	}