mirror of
https://github.com/mirror/make.git
synced 2025-01-01 07:50:52 +08:00
* src/arscan.c (ar_scan): Avoid sign comparison warnings
Pacify 12.2.1 20220819 (Red Hat 12.2.1-2) -Wsign-compare by checking the readbuf() return explicitly for errors then casting from ssize_t. Initial patch provided by Paul Eggert <eggert@cs.ucla.edu>.
This commit is contained in:
parent
ae80eefe65
commit
ca92d83cde
@ -716,12 +716,12 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
|
||||
const char* err;
|
||||
unsigned int name_len = make_toui (name + 3, &err);
|
||||
|
||||
if (err || name_len == 0 || name_len > PATH_MAX)
|
||||
if (err || name_len == 0 || name_len >= MIN (PATH_MAX, INT_MAX))
|
||||
goto invalid;
|
||||
|
||||
name = alloca (name_len + 1);
|
||||
nread = readbuf (desc, name, name_len);
|
||||
if (nread != name_len)
|
||||
if (nread < 0 || (unsigned int) nread != name_len)
|
||||
goto invalid;
|
||||
|
||||
name[name_len] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user