fix string termination bug in commit_tree_parse
authorChristian Thaeter <ct@pipapo.org>
Fri, 8 Feb 2008 07:16:56 +0000 (08:16 +0100)
committerChristian Thaeter <ct@pipapo.org>
Fri, 8 Feb 2008 07:16:56 +0000 (08:16 +0100)
src/object_commit.c

index 5f826c1..45903bb 100644 (file)
@@ -30,7 +30,11 @@ webgit_object_commit_tree_parse (struct commit* commit)
   char* tree = strstr (commit->buffer, "tree ");
   if (!tree)
     return NULL;
-  return strncpy (cwa_buffer_provide (41), tree+5, 40);
+
+  char* ret = strncpy (cwa_buffer_provide (41), tree+5, 40);
+  ret[40] = '\0';
+
+  return ret;
 }
 
 time_t