git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Juergen Ruehle <j.ruehle@bmiag.de>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Jon Smirl <jonsmirl@gmail.com>,
	git@vger.kernel.org, junkio@cox.net,
	Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Subject: Re: [PATCH 2/2] builtin git-mv: support moving directories
Date: Tue, 8 Aug 2006 20:34:24 +0200	[thread overview]
Message-ID: <17624.55600.423000.61479@lapjr.intranet.kiel.bmiag.de> (raw)
In-Reply-To: <Pine.LNX.4.63.0607261941210.29667@wbgn013.biozentrum.uni-wuerzburg.de>

This might have been fixed already (my tree is a couple of days old),
but the strcat fails for me, because the alloced memory is not
cleared.

Johannes Schindelin writes:
 > +static const char *add_slash(const char *path)
 > +{
 > +	int len = strlen(path);
 > +	if (path[len - 1] != '/') {
 > +		char *with_slash = xmalloc(len + 2);
 > +		memcpy(with_slash, path, len);
 > +		strcat(with_slash + len, "/");
 > +		return with_slash;
 > +	}
 > +	return path;
 > +}

perhaps morph the strcat into a memcopy or append the slash and the
NUL manually?

  jr

  parent reply	other threads:[~2006-08-08 18:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-26 17:47 [PATCH 2/2] builtin git-mv: support moving directories Johannes Schindelin
2006-07-26 19:58 ` Junio C Hamano
2006-08-08 18:34 ` Juergen Ruehle [this message]
2006-08-08 19:52   ` Junio C Hamano
2006-08-08 22:36   ` [PATCH] mv: strcat -> strcpy to account for uninitialized memory Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17624.55600.423000.61479@lapjr.intranet.kiel.bmiag.de \
    --to=j.ruehle@bmiag.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=Josef.Weidendorfer@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=jonsmirl@gmail.com \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).