summaryrefslogtreecommitdiffstats
path: root/libtar/block.c
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2017-07-06 05:10:24 +0200
committerEthan Yonker <dees_troy@teamw.in>2017-07-06 17:10:13 +0200
commitda056fdc5bc781a38e13078d23eb15f5cb6c1ae3 (patch)
tree85d67aaf0a967cbe03bd01be0c07269d1372c7df /libtar/block.c
parentComplete support for project pathmap (diff)
downloadandroid_bootable_recovery-da056fdc5bc781a38e13078d23eb15f5cb6c1ae3.tar
android_bootable_recovery-da056fdc5bc781a38e13078d23eb15f5cb6c1ae3.tar.gz
android_bootable_recovery-da056fdc5bc781a38e13078d23eb15f5cb6c1ae3.tar.bz2
android_bootable_recovery-da056fdc5bc781a38e13078d23eb15f5cb6c1ae3.tar.lz
android_bootable_recovery-da056fdc5bc781a38e13078d23eb15f5cb6c1ae3.tar.xz
android_bootable_recovery-da056fdc5bc781a38e13078d23eb15f5cb6c1ae3.tar.zst
android_bootable_recovery-da056fdc5bc781a38e13078d23eb15f5cb6c1ae3.zip
Diffstat (limited to '')
-rw-r--r--libtar/block.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libtar/block.c b/libtar/block.c
index a94ba445d..8b2205933 100644
--- a/libtar/block.c
+++ b/libtar/block.c
@@ -347,11 +347,13 @@ th_read(TAR *t)
{
start += E4CRYPT_TAG_LEN;
char *end = strchr(start, '\n');
+ if(!end)
+ end = strchr(start, '\0');
if(end)
{
- t->th_buf.e4crypt_policy = strndup(start, end-start);
+ t->th_buf.e4crypt_policy = strndup(start, end-start);
#ifdef DEBUG
- printf(" th_read(): E4Crypt policy detected: %s\n", t->th_buf.e4crypt_policy);
+ printf(" th_read(): E4Crypt policy detected: %s\n", t->th_buf.e4crypt_policy);
#endif
}
}
@@ -563,7 +565,7 @@ th_write(TAR *t)
#endif
/* setup size - EXT header has format "*size of this whole tag as ascii numbers* *space* *content* *newline* */
// size newline
- sz = E4CRYPT_TAG_LEN + EXT4_KEY_DESCRIPTOR_HEX + 3 + 1;
+ sz = E4CRYPT_TAG_LEN + strlen(t->th_buf.e4crypt_policy) + 3 + 1;
if(sz >= 100) // another ascci digit for size
++sz;