git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
JAJan Andres <jandres@gmx.net>
Date
Nov 29, 2005, 15:30 UTC
Message-ID
<20051129153046.GA9091@pitr.home.jan>
In-Reply-To
<20051129133537.GA490@pitr.home.jan>
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>
Previous: Jan AndresNext: Johannes Schindelin
Message 5 of 6 in “Fix typo in http-push.c”
  1. Fix typo in http-push.cJan Andres, Nov 29, 2005
  2. Junio C HamanoNov 29, 2005
  3. Johannes SchindelinNov 29, 2005
  4. Jan AndresNov 29, 2005
  5. Fix typo in http-push.c, take twoJan Andres, Nov 29, 2005
  6. Johannes SchindelinNov 29, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.