Re: [RFC PATCHv2] repack: rewrite the shell script in C.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Aug 17, 2013, at 06:34, René Scharfe wrote:
On Aug 15, 2013, at 17:12, Stefan Beller wrote:
+		if (sha_begin >= e->d_name && !strncmp(sha_begin, sha1, 40)) {
+			char *fname;
+			fname = xmalloc(strlen(path) + 1 + strlen(e->d_name));

This needs another +1 because

+			sprintf(fname, "%s/%s", path, e->d_name);

len(path) + len("/") + len(e->d_name) + len("\0")


mkpathdup..

+			unlink(fname);
+			/*TODO: free(fname); fails here sometimes, needs investigation*/

Strange.  Perhaps valgrind can tell you what's wrong.

which is probably why it fails since the byte beyond the end of fname is being overwritten with a nul.--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]