Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <AOsAZwCALNvXp*Sa5oiy4qoa.1.1795623892713.Hmail.2601110895@stu.pku.edu.cn>
Date: Thu, 26 Nov 2026 00:24:52 +0800 (GMT+08:00)
From: 吴尚哲 <wushangzhe26@....pku.edu.cn>
To: musl <musl@...ts.openwall.com>
Subject: Bug in fgetspent(): signed overflow when parsing shadow fields

Hello,
We found a bug in fgetspent() in musl 1.2.5 on x86_64: when the
last password change field in a shadow entry contains a decimal value
outside the range of long, fgetspent() can return an entry with an
incorrect sp_lstchg value.

In src/passwd/getspnam_r.c, xatol() accumulates the digits with:

    for (x=0; **s-'0'<10U; ++*s) x=10*x+(**s-'0');

Because x is a signed long and the loop performs no range check, the
multiplication or addition can overflow. In our x86_64 test, the
regular build returned an entry with sp_lstchg set to LONG_MIN. The
UBSan trap build raised SIGILL on the same input.




Thanks,
Shangzhe



 


Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.