Skip to content

Commit

Permalink
luks/udisks2: explicitly NULL-terminate buffer
Browse files Browse the repository at this point in the history
Technically, req.data is already NULL-terminated, but let's
be explicit about this.

Signed-off-by: Sergio Correia <[email protected]>
  • Loading branch information
sergio-correia committed Mar 5, 2024
1 parent ff4d986 commit e769432
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/luks/udisks2/clevis-luks-udisks2.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,9 @@ main(int argc, char *const argv[])
req.used = recv(pair[0], req.data, sizeof(req.data), 0);
if (req.used < 1 || req.data[req.used - 1])
break;
/* Technically, req.data is already NULL-terminated, but let's
* be explicit. */
req.data[req.used - 1] = '\0';

if (crypt_init(&cd, req.data) < 0)
goto next;
Expand Down

0 comments on commit e769432

Please sign in to comment.