Skip to content

Commit 7cf238d

Browse files
committed
Stop parsing auxvec after AT_NULL
1 parent eb0d413 commit 7cf238d

File tree

1 file changed

+4
-0
lines changed
  • crates/std_detect/src/detect/os/linux

1 file changed

+4
-0
lines changed

crates/std_detect/src/detect/os/linux/auxvec.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//! Parses ELF auxiliary vectors.
22
#![cfg_attr(not(target_arch = "aarch64"), allow(dead_code))]
33

4+
pub(crate) const AT_NULL: usize = 0;
5+
46
/// Key to access the CPU Hardware capabilities bitfield.
57
pub(crate) const AT_HWCAP: usize = 16;
68
/// Key to access the CPU Hardware capabilities 2 bitfield.
@@ -170,6 +172,7 @@ fn auxv_from_buf(buf: &[usize; 64]) -> Result<AuxVec, ()> {
170172
{
171173
for el in buf.chunks(2) {
172174
match el[0] {
175+
AT_NULL => break,
173176
AT_HWCAP => return Ok(AuxVec { hwcap: el[1] }),
174177
_ => (),
175178
}
@@ -186,6 +189,7 @@ fn auxv_from_buf(buf: &[usize; 64]) -> Result<AuxVec, ()> {
186189
let mut hwcap2 = None;
187190
for el in buf.chunks(2) {
188191
match el[0] {
192+
AT_NULL => break,
189193
AT_HWCAP => hwcap = Some(el[1]),
190194
AT_HWCAP2 => hwcap2 = Some(el[1]),
191195
_ => (),

0 commit comments

Comments
 (0)