[PATCH] Fix typo in http-push.c, take two

From: Jan Andres <jandres@gmx.net>
Date: 2005-11-30 02:30:46
Ok, so this is my final(?) proposal for the fix.

---

Fix a bug in handle_new_lock_ctx()'s memory allocation which may cause
segfaults.

Signed-off-by: Jan Andres <jandres@gmx.net>

---

diff --git a/http-push.c b/http-push.c
index 76c7886..bbb5118 100644
--- a/http-push.c
+++ b/http-push.c
@@ -784,7 +784,8 @@ static void handle_new_lock_ctx(struct x
 					strtol(ctx->cdata + 7, NULL, 10);
 		} else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TOKEN)) {
 			if (!strncmp(ctx->cdata, "opaquelocktoken:", 16)) {
-				lock->token = xmalloc(strlen(ctx->cdata - 15));
+				lock->token =
+					xmalloc(strlen(ctx->cdata + 16) + 1);
 				strcpy(lock->token, ctx->cdata + 16);
 			}
 		}
---
0.99.9.GIT

-- 
Jan Andres <jandres@gmx.net>
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Nov 30 03:24:48 2005

This archive was generated by hypermail 2.1.8 : 2005-11-30 03:24:54 EST