Skip to content

Commit

Permalink
Fix return code for ssize_t.
Browse files Browse the repository at this point in the history
The ssize_t must be defined in the range [-1, SSIZE_MAX].

The return value is overwritten to -EINVAL later anyway,
return -1 here to be on the safe side.

Fixes: #900
  • Loading branch information
mbroz committed Aug 26, 2024
1 parent a42bd08 commit 3d89fac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils_password.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static ssize_t read_tty_eol(int fd, char *pass, size_t maxlen)
ssize_t r, read_size = 0;

if (maxlen > SSIZE_MAX)
return -EINVAL;
return -1;

do {
r = read(fd, pass, maxlen - read_size);
Expand Down

0 comments on commit 3d89fac

Please sign in to comment.