Commit 925dac2c authored by Milan Broz's avatar Milan Broz

Fix hash lowercase conversion for malformed string.

git-svn-id: 36d66b0a-2a48-0410-832c-cd162a569da5
parent d93a925b
......@@ -278,9 +278,9 @@ static int _check_and_convert_hdr(const char *device,
return r;
static void _to_lower(char *str)
static void _to_lower(char *str, unsigned max_len)
for(; *str; str++)
for(; *str && max_len; str++, max_len--)
if (isupper(*str))
*str = tolower(*str);
......@@ -289,7 +289,7 @@ static void LUKS_fix_header_compatible(struct luks_phdr *header)
/* Old cryptsetup expects "sha1", gcrypt allows case insensistive names,
* so always convert hash to lower case in header */
_to_lower(header->hashSpec, LUKS_HASHSPEC_L);
int LUKS_read_phdr_backup(const char *backup_file,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment