mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-06 00:10:04 +01:00
Do not use assert() that depends on external data.
Just fail function. Also fixed gcc analyzer warning (leaked fd).
This commit is contained in:
@@ -171,7 +171,10 @@ static key_serial_t find_key_by_type_and_desc(const char *type, const char *desc
|
||||
}
|
||||
|
||||
buffer_len -= newline - buf + 1;
|
||||
assert(buffer_len <= sizeof(buf) - 1);
|
||||
if (buffer_len >= sizeof(buf)) {
|
||||
close(f);
|
||||
return 0;
|
||||
}
|
||||
memmove(buf, newline + 1, buffer_len);
|
||||
buf[buffer_len] = '\0';
|
||||
newline = strchr(buf, '\n');
|
||||
|
||||
Reference in New Issue
Block a user