[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] xalloc: add xstrndup
From: |
Paul Eggert |
Subject: |
Re: [Bug-gnulib] xalloc: add xstrndup |
Date: |
14 Aug 2003 20:10:19 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Simon Josefsson <address@hidden> writes:
> I did not include MODULES.html.sh documentation since xmalloc,
> xstrdup, etc was not mentioned.
It shouldn't be necessary, since the info is gotten from modules/xalloc.
> + /* FIXME we may allocate more than needed amount. however strlen()
> + may read out of bounds in case string is not zero terminated.
> + looping through string (limited by n) waste cpu, this waste
> + memory. */
Why not do something like this instead?
char *s = strndup (string, n);
if (! s)
xalloc_die ();
return s;
- [Bug-gnulib] xalloc: add xstrndup, Simon Josefsson, 2003/08/14
- Re: [Bug-gnulib] xalloc: add xstrndup,
Paul Eggert <=
- Re: [Bug-gnulib] xalloc: add xstrndup, Bruno Haible, 2003/08/15
- Re: [Bug-gnulib] xalloc: add xstrndup, Paul Eggert, 2003/08/15
- Re: [Bug-gnulib] xalloc: add xstrndup, Simon Josefsson, 2003/08/15
- Re: [Bug-gnulib] xalloc: add xstrndup, Bruno Haible, 2003/08/17
- Re: [Bug-gnulib] xalloc: add xstrndup, Simon Josefsson, 2003/08/17
- Re: [Bug-gnulib] xalloc: add xstrndup, Bruno Haible, 2003/08/18
- Re: [Bug-gnulib] xalloc: add xstrndup, Paul Eggert, 2003/08/18
- Re: [Bug-gnulib] xalloc: add xstrndup, Derek Robert Price, 2003/08/22
- Re: [Bug-gnulib] xalloc: add xstrndup, Bruno Haible, 2003/08/22