mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 12:05:30 +00:00
Sanitize any bad chars from mount_apex apex_manifest.pb string parsing
For example, Lineage's com.android.ondevicepersonalization apex_manifest.pb has a # char, which strings keeps in its output, and breaks the mount for that apex before this fix
This commit is contained in:
parent
d9f0aed571
commit
33fb4653f0
@ -336,7 +336,7 @@ mount_apex() {
|
|||||||
[ -f /apex/original_apex ] && APEX=/apex/original_apex # unzip doesn't do return codes
|
[ -f /apex/original_apex ] && APEX=/apex/original_apex # unzip doesn't do return codes
|
||||||
# APEX APKs, extract and loop mount
|
# APEX APKs, extract and loop mount
|
||||||
unzip -qo $APEX apex_payload.img -d /apex
|
unzip -qo $APEX apex_payload.img -d /apex
|
||||||
DEST=$(unzip -qp $APEX apex_manifest.pb | strings | head -n 1)
|
DEST=$(unzip -qp $APEX apex_manifest.pb | strings | head -n 1 | tr -dc [:alnum:].-_'\n')
|
||||||
[ -z $DEST ] && DEST=$(unzip -qp $APEX apex_manifest.json | sed -n $PATTERN)
|
[ -z $DEST ] && DEST=$(unzip -qp $APEX apex_manifest.json | sed -n $PATTERN)
|
||||||
[ -z $DEST ] && continue
|
[ -z $DEST ] && continue
|
||||||
DEST=/apex/$DEST
|
DEST=/apex/$DEST
|
||||||
@ -352,7 +352,7 @@ mount_apex() {
|
|||||||
if [ -f $APEX/apex_manifest.json ]; then
|
if [ -f $APEX/apex_manifest.json ]; then
|
||||||
DEST=/apex/$(sed -n $PATTERN $APEX/apex_manifest.json)
|
DEST=/apex/$(sed -n $PATTERN $APEX/apex_manifest.json)
|
||||||
elif [ -f $APEX/apex_manifest.pb ]; then
|
elif [ -f $APEX/apex_manifest.pb ]; then
|
||||||
DEST=/apex/$(strings $APEX/apex_manifest.pb | head -n 1)
|
DEST=/apex/$(strings $APEX/apex_manifest.pb | head -n 1 | tr -dc [:alnum:].-_'\n')
|
||||||
else
|
else
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user