Commit 85b91652018867d67642cb3207084561b85969af

Kirill A. Shutemov 2011-08-25T23:57:06

pkt: use sizeof() instead of strlen() to avoid variable length array Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/pkt.c b/src/pkt.c
index f802bbd..4eac041 100644
--- a/src/pkt.c
+++ b/src/pkt.c
@@ -302,7 +302,7 @@ int git_pkt_send_wants(git_headarray *refs, git_transport_caps *caps, int fd)
 {
 	unsigned int i = 0;
 	int error = GIT_SUCCESS;
-	char buf[strlen(WANT_PREFIX) + GIT_OID_HEXSZ + 2];
+	char buf[sizeof(WANT_PREFIX) + GIT_OID_HEXSZ + 1];
 	git_remote_head *head;
 
 	memcpy(buf, WANT_PREFIX, strlen(WANT_PREFIX));