Problem: crypt: cannot decrypt empty file (smss2022)
Solution: Update wrong condition in check_for_cryptkey()
(Foxe Chen)
fixes: #19416
closes: #19455
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
int header_len;
header_len = crypt_get_header_len(method);
- if (*sizep <= header_len)
+ if (*sizep < header_len)
// invalid header, buffer can't be encrypted
return NULL;
bwipe!
endfunc
+" Test unencrypted an empty file
+func Test_uncrypt_empty()
+ CheckFeature sodium
+
+ let hex =<< trim END
+ 00000000: 5669 6d43 7279 7074 7e30 3521 f02f 52ed VimCrypt~05!./R.
+ 00000010: adc3 e5f3 e06c 2fc8 3ce3 ffde d48b 95fe .....l/.<.......
+ 00000020: 341e 74f7 0200 0000 0000 0000 0000 0004 4.t.............
+ 00000030: 0000 0000 0200 0000 ........
+ END
+
+ call Uncrypt_stable_xxd('xchacha20v2', hex, "vim", [""], 0)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 42,
/**/
41,
/**/