From: dave at horsfall.org (Dave Horsfall)
Subject: [COFF] [TUHS] buffer overflow (Re: Happy birthday Morris worm
Date: Wed, 13 Nov 2019 12:11:56 +1100 (EST) [thread overview]
Message-ID: <alpine.BSF.2.21.9999.1911131109110.11612@aneurin.horsfall.org> (raw)
In-Reply-To: <CANCZdfrnOfxV-TP09Ye15FVLKuZAAudEd=FQ-iULgE1js4ra4Q@mail.gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]
(Narrowly diverted in time to COFF from TUHS when I saw Warren's email, so
I hope Warner is on it.)
On Tue, 12 Nov 2019, Warner Losh wrote:
> POSIX can't even recognize that leap seconds exist :(
There's a movement afoot to abolish leap seconds because they are
"inconvenient" or something; that will upset the astronomers and other
people who care about the exact time.
> All is not lost, though; use strncpy() instead of strcpy() etc.
>
> strncpy has two issues. First, it doesn't guarantee NUL termination.
> Second, it always writes N bytes. It's for a fixed width data field, not
> a variable length string whose buffer size is known. strlcpy is much
> better, but still has some issues...
Yeah, I knew about the NUL termination (or lack of it) - I didn't think to
mention it. When I use it, I copy n-1 bytes and plant the NUL in there
myself (depending on how I'm using it).
And I wasn't aware of strlcpy() - thanks. Too many functions to keep
track of these days....
Trivia: curious to see how Australia's "talking clock" (long gone in
favour of NTP, alas) handled the leap second, I recorded it (it puts a gap
before the last beep). It can be heard (and seen!) over on
www.horsfall.org/leapsecond.webm .
And yes, that old long-haired hippie is me...
-- Dave
next parent reply other threads:[~2019-11-13 1:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1573592179.5935.for-standards-violators@oclsc.org>
[not found] ` <20191112221053.C2009156E80B@mail.bitblocks.com>
[not found] ` <alpine.BSF.2.21.9999.1911130944090.11612@aneurin.horsfall.org>
[not found] ` <CANCZdfrnOfxV-TP09Ye15FVLKuZAAudEd=FQ-iULgE1js4ra4Q@mail.gmail.com>
2019-11-13 1:11 ` dave [this message]
2019-11-13 1:14 ` dave
[not found] ` <20191112221418.GJ16268@mcvoy.com>
[not found] ` <20191112224151.GA36336@fuz.su>
[not found] ` <5d8d9933-1213-3f07-02e0-f3ad5c293de4@kilonet.net>
2019-11-13 8:37 ` peter
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.BSF.2.21.9999.1911131109110.11612@aneurin.horsfall.org \
--to=coff@minnie.tuhs.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 NNTP newsgroup(s).