ima-evm-utils: tests: fix finding the "boot_aggregate" value
Mimi Zohar
maintainerPATCH 1/1 ima-evm-utils: tests: fix finding the "boot_aggregate" value
Searching for the last "boot_aggregate" record in the measurement list could inadvertently match a filename containing the string "boot_aggregate". Prevent this from happening.
Signed-off-by Mimi Zohar <[email protected]>
--- tests/boot_aggregate.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/boot_aggregate.test +1 -1
@@ -121,7 +121,7 @@ check() { if [ "$VERBOSE" != "0" ]; then echo "$hash" fi - if grep -e "boot_aggregate$" -e "boot_aggregate.$" "${ASCII_RUNTIME_MEASUREMENTS}" | tail -n 1 | grep -q "${hash}"; then + if grep -e " boot_aggregate$" -e " boot_aggregate.$" "${ASCII_RUNTIME_MEASUREMENTS}" | tail -n 1 | grep -q "${hash}"; then echo "${GREEN}SUCCESS: boot_aggregate ${hash} found${NORM}" return "$OK" fi
Signature · 1 line
2.7.5
Quoted 25 lines · Mimi Zohar
Searching for the last "
boot_aggregate" record in the measurement list could inadvertently match a filename containing the string "boot_aggregate". Prevent this from happening.Signed-off-by Mimi Zohar <[email protected]>--- tests/boot_aggregate.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/boot_aggregate.test +1
-1@@ -121,7 +121,7 @@ check() { if [ "$VERBOSE" != "0" ]; then echo "$hash" fi - if grep -e "boot_aggregate$" -e "boot_aggregate.$" "${ASCII_RUNTIME_MEASUREMENTS}" | tail -n 1 | grep -q "${hash}"; then + if grep -e " boot_aggregate$" -e " boot_aggregate.$" "${ASCII_RUNTIME_MEASUREMENTS}" | tail -n 1 | grep -q "${hash}"; then echo "${GREEN}SUCCESS: boot_aggregate ${hash} found${NORM}" return "$OK" fiSignature · 1 line
2.7.5
Considering whitespaces in between file name words are translated to "_" (underscore) in measurement file:
Reviewed-by Bruno Meneguele <[email protected]>
Signature · 2 lines
bmeneg PGP Key: http://bmeneg.com/pubkey.txt