From: Joshua Rogers <megamansec@gmail.com>
To: util-linux@vger.kernel.org
Subject: off-by-one issues in login-utils
Date: Sat, 22 Nov 2014 18:34:25 +1100 [thread overview]
Message-ID: <54703C81.7000902@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 588 bytes --]
Hi,
I've noticed a few off-by-one issues in login-utils..
login.c:963: strncpy(ut.ut_user, username, sizeof(ut.ut_user));
It should be sizeof(ut.ut_user) - 1.
Or, something like
ut.ut_user[sizeof(ut.ut_user) -1] = '\0';
And on line 275:
memset(&ut, 0, sizeof(ut));
strncpy(ut.ut_user, username ? username : "(unknown)",
sizeof(ut.ut_user));
I can't see anywhere that adds the final NUL-byte to ut.ut_user.
If I've missed something though, feel free to ignore this.
Thanks,
--
-- Joshua Rogers <https://internot.info/>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
next reply other threads:[~2014-11-22 7:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-22 7:34 Joshua Rogers [this message]
2014-11-23 19:52 ` off-by-one issues in login-utils Ángel González
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=54703C81.7000902@gmail.com \
--to=megamansec@gmail.com \
--cc=util-linux@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.