From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Alf Clement <alf.clement@gmail.com>
Cc: Alex Riesen <raa.lkml@gmail.com>,
git@vger.kernel.org, Junio C Hamano <junkio@cox.net>
Subject: Re: [PATCH] Add test-tr: poor-man tr
Date: Thu, 12 Jun 2008 08:25:09 +0100 (BST) [thread overview]
Message-ID: <alpine.DEB.1.00.0806120822140.1783@racer> (raw)
In-Reply-To: <556d90580806112332s25f76caajaaafa8e16e895922@mail.gmail.com>
Hi,
On Thu, 12 Jun 2008, Alf Clement wrote:
> > +static unsigned char *unquote(const char *s, unsigned *len) +{
> > + unsigned char *result = malloc(strlen(s)), *r = result;
>
> are you sure that the buffer is big enough?? Nomally you do a
> malloc(strlen(s)+1).
AFAIU a "tr" really only ever replaces single characters by single
characters. So, not even looking at the code -- just like you -- I would
expect it to get the exact number of bytes read, and to write the same
number of bytes.
I certainly would not expect it to do something string based, introducing
a silly expectation of NUL-terminations (which tr(1) does not expect
either).
Ciao,
Dscho
next prev parent reply other threads:[~2008-06-12 7:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-11 18:25 [PATCH] Add test-tr: poor-man tr Alex Riesen, Alex Riesen
2008-06-11 18:26 ` [PATCH] Use test-tr in the tests Alex Riesen
2008-06-11 21:34 ` [PATCH] Add test-tr: poor-man tr Alex Riesen
2008-06-11 22:54 ` Jeff King
2008-06-12 6:01 ` Alex Riesen
2008-06-12 6:23 ` Jeff King
2008-06-12 6:28 ` Jeff King
2008-06-12 20:32 ` Alex Riesen
2008-06-13 6:02 ` Jeff King
2008-06-13 17:26 ` Alex Riesen
2008-06-13 18:00 ` Jeff King
2008-06-12 6:32 ` Alf Clement
2008-06-12 7:25 ` Johannes Schindelin [this message]
2008-06-12 20:20 ` Alex Riesen, Alex Riesen
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=alpine.DEB.1.00.0806120822140.1783@racer \
--to=johannes.schindelin@gmx.de \
--cc=alf.clement@gmail.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=raa.lkml@gmail.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