public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "xiechengliang1 at huawei dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/26657] New: strncpy in login/login.c line 114 might leave the destination string unterminate
Date: Wed, 23 Sep 2020 11:57:05 +0000	[thread overview]
Message-ID: <bug-26657-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=26657

            Bug ID: 26657
           Summary: strncpy in login/login.c line 114 might leave the
                    destination string unterminate
           Product: glibc
           Version: 2.31
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: xiechengliang1 at huawei dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

The glibc-2.31/login/login.c 114 line contains the following code:
    strncpy (copy.ut_line, ttyp, UT_LINESIZE);

  The UT_LINESIZE size is 32 bytes,and the size of the destination array
"copy.ut_line" is also 32 bytes. The code cannot ensure that the "ttyp" ends
with '\0'. so calling "strncpy" might leave the destination string
unterminated. When strlen is used to obtain the length of the "copy.ut_line"
array, a buffer overflow occurs.

  Consider setting the 32nd bit of the "copy.ut_line" array to '\0' to fix it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2020-09-23 11:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 11:57 xiechengliang1 at huawei dot com [this message]
2020-09-23 12:10 ` [Bug libc/26657] " schwab@linux-m68k.org
2020-09-23 12:42 ` fweimer at redhat dot com

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=bug-26657-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.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).