git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] sha1_name: use strlcpy() to copy strings
Date: Sun, 22 Feb 2015 23:33:16 +0100	[thread overview]
Message-ID: <54EA592C.6040701@web.de> (raw)
In-Reply-To: <xmqqsidxvhrk.fsf@gitster.dls.corp.google.com>

Am 22.02.2015 um 21:00 schrieb Junio C Hamano:
> René Scharfe <l.s.r@web.de> writes:
>
>> Use strlcpy() instead of calling strncpy() and then setting the last
>> byte of the target buffer to NUL explicitly.  This shortens and
>> simplifies the code a bit.
>
> Thanks.  It makes me wonder if the longer term direction should be
> not to use a bound buffer for oc->path, though.

That's a good idea in general, but a bit more involved since we'd need 
to introduce a cleanup function that releases the memory allocated by 
the new version of get_sha1_with_context() first and call it from the 
appropriate places.

Would that be a good micro-project for GSoC or is it too simple?

René

  reply	other threads:[~2015-02-22 22:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-21 19:55 [PATCH] sha1_name: use strlcpy() to copy strings René Scharfe
2015-02-22 20:00 ` Junio C Hamano
2015-02-22 22:33   ` René Scharfe [this message]
2015-02-23 18:36     ` Jeff King

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

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

  git send-email \
    --in-reply-to=54EA592C.6040701@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
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 NNTP newsgroup(s).