From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BC4A9383F859; Wed, 16 Dec 2020 14:12:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC4A9383F859 From: "siddhesh at sourceware dot org" To: glibc-bugs@sourceware.org Subject: [Bug libc/27083] New: Unsafe unbounded alloca in addmntent Date: Wed, 16 Dec 2020 14:12:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: siddhesh at sourceware dot org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2020 14:12:55 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27083 Bug ID: 27083 Summary: Unsafe unbounded alloca in addmntent Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: siddhesh at sourceware dot org CC: drepper.fsp at gmail dot com Target Milestone: --- addmntent duplicates strings in its input struct mntent using alloca due to which very long strings could blow up the stack. Example: #include #include #include #include #define LARGE_VALUE 2*1024*1024*1024ULL int main(int argc, char **argv) { FILE *f =3D fopen("/dev/null", "w"); struct mntent bad; bad.mnt_fsname =3D calloc (LARGE_VALUE, 1); memset (bad.mnt_fsname, ' ', LARGE_VALUE - 1); bad.mnt_dir =3D calloc (LARGE_VALUE, 1); memset (bad.mnt_dir, ' ', LARGE_VALUE - 1); bad.mnt_type =3D calloc (LARGE_VALUE, 1); memset (bad.mnt_type, ' ', LARGE_VALUE - 1); bad.mnt_opts =3D calloc (LARGE_VALUE, 1); memset (bad.mnt_opts, ' ', LARGE_VALUE - 1); bad.mnt_freq =3D 1; bad.mnt_passno =3D 2; addmntent (f, &bad); endmntent(f); return 0; } --=20 You are receiving this mail because: You are on the CC list for the bug.=