[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new module 'strlcpy'
From: |
Bruno Haible |
Subject: |
Re: new module 'strlcpy' |
Date: |
Thu, 28 Sep 2017 02:44:53 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-93-generic; KDE/5.18.0; x86_64; ; ) |
I wrote:
> In some places the users
> will notice that strlcpy does not buy them much, compared to the
> "avoid arbitrary limits"[1] approach, and will switch over to what
> you call "GNU style". In other places, they will insert an abort()
> or assert() to handle the truncation case - which is *better* than
> the strncpy approach.
For example, in gnulib's setlocale.c override. This file has fixed-size
buffers and silent truncation - because it uses the "strncpy and set NUL byte"
approach. As soon as someone (me) will use strlcpy with __warn_unused_result__
there, he will change the code to do
- either dynamic allocation and no arbitrary limits,
- or provide a good alternative to the silent truncation.
Either result will be better than the current one.
Bruno
- [PATCH 1/6] parse-datetime, posixtm: avoid uninit access, Paul Eggert, 2017/09/25
- [PATCH 2/6] parse-datetime: fix dependency, Paul Eggert, 2017/09/25
- [PATCH 3/6] sys_types: update URL, Paul Eggert, 2017/09/25
- [PATCH 4/6] maint: fix overflow checking in nap.h, Paul Eggert, 2017/09/25
- [PATCH 5/6] duplocale-tests: fix unlikely crash, Paul Eggert, 2017/09/25
- new module 'strlcpy', Bruno Haible, 2017/09/27
- Re: new module 'strlcpy', Paul Eggert, 2017/09/27
- Re: new module 'strlcpy', Bruno Haible, 2017/09/27
- Re: new module 'strlcpy',
Bruno Haible <=
- Re: new module 'strlcpy', Jim Meyering, 2017/09/27
- Re: new module 'strlcpy', Bruno Haible, 2017/09/28
- Re: new module 'strlcpy', Paul Eggert, 2017/09/28
- Re: new module 'strlcpy', Paul Eggert, 2017/09/27
- Re: new module 'strlcpy', Dmitry Selyutin, 2017/09/28
- Re: new module 'strlcpy', Tim Rühsen, 2017/09/28
- Re: new module 'strlcpy', Paul Eggert, 2017/09/28
- Re: alternatives to 'strlcpy', Bruno Haible, 2017/09/28
- Re: alternatives to 'strlcpy', Dmitry Selyutin, 2017/09/28
- Re: alternatives to 'strlcpy', Paul Eggert, 2017/09/28