bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Bruno Haible <bruno@clisp.org>
Cc: Gnulib bugs <bug-gnulib@gnu.org>, Jonas Termansen <sortie@maxsi.org>
Subject: Re: critique of gnulib
Date: Sat, 31 Aug 2019 16:20:35 -0700	[thread overview]
Message-ID: <6db86ac1-944f-cc42-cc49-35351f0c9fd8@cs.ucla.edu> (raw)
In-Reply-To: <1704385.skmA4EAMxR@omega>

Bruno Haible wrote:
> https://gitlab.com/sortix/sortix/wikis/Gnulib
>> sprintf calls.
> What do you mean? sprintf is a standardized libc function.

I imagine Jonas is referring to the practice of avoiding sprintf and using 
snprintf instead, under the theory that sprintf can be dangerous. Gnulib does 
not follow that practice; instead, it avoids dangerous uses of sprintf. 
Similarly for strcpy and for several other C functions that can be dangerous if 
misused.

The Gnulib style for sprintf helps avoid the common problem of inadvertently 
truncating strings.[1] Admittedly (and as Bruno knows) this has long been a 
controversial area.[2][3]

[1] 
https://wiki.sei.cmu.edu/confluence/display/c/STR03-C.+Do+not+inadvertently+truncate+a+string
[2] https://lists.gnu.org/archive/html/bug-gnulib/2004-09/msg00181.html
[3] https://sourceware.org/ml/libc-alpha/2002-01/msg00133.html


  reply	other threads:[~2019-08-31 23:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-31 21:46 critique of gnulib Bruno Haible
2019-08-31 23:20 ` Paul Eggert [this message]
2019-09-01 21:53   ` Jonas 'Sortie' Termansen
2019-09-01 22:46     ` Paul Eggert
2019-09-08 17:08       ` critique of gnulib - string allocation Bruno Haible
2019-09-08 17:47         ` Ben Pfaff
2019-09-08 20:17         ` Paul Eggert
2019-09-08 20:58           ` Bruno Haible
2019-09-08 23:29             ` Paul Eggert
2019-09-09  1:04       ` critique of gnulib - cross-compilation guesses Bruno Haible
2019-09-08 17:20     ` critique of gnulib - stdioext Bruno Haible
2019-09-08 17:28     ` critique of gnulib - malloc wrapper Bruno Haible
2019-09-09  1:24     ` critique of gnulib - disabling workarounds Bruno Haible

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: https://lists.gnu.org/mailman/listinfo/bug-gnulib

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

  git send-email \
    --in-reply-to=6db86ac1-944f-cc42-cc49-35351f0c9fd8@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=sortie@maxsi.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).