$OpenBSD: patch-camel_camel_lock_helper_c,v 1.1 2005/01/30 14:44:46 robert Exp $
--- camel/camel-lock-helper.c.orig	Wed Jan 26 15:34:53 2005
+++ camel/camel-lock-helper.c	Wed Jan 26 15:37:15 2005
@@ -360,8 +360,9 @@
 			switch(msg.id) {
 			case CAMEL_LOCK_HELPER_LOCK:
 				res = CAMEL_LOCK_HELPER_STATUS_NOMEM;
-				path = malloc(msg.data+1);
-				if (path != NULL) {
+				if (msg.data > 0xffff) {
+					res = CAMEL_LOCK_HELPER_STATUS_PROTOCOL;
+				} else if ((path = malloc(msg.data+1)) != NULL) {
 					res = CAMEL_LOCK_HELPER_STATUS_PROTOCOL;
 					len = read_n(STDIN_FILENO, path, msg.data);
 					if (len == msg.data) {
