Skip to content

Commit c3975e5

Browse files
committed
iolog_write() returns -1 on failure, not false.
Found by the ZeroPath AI Security Engineer <https://zeropath.com>
1 parent 61c5a99 commit c3975e5

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

logsrvd/logsrvd_local.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -670,15 +670,16 @@ store_iobuf_local(int iofd, const IoBuffer *iobuf, const uint8_t *buf,
670670
}
671671

672672
/* Write to specified I/O log file. */
673-
if (!iolog_write(&closure->iolog_files[iofd], data.data, data.len, &errstr)) {
673+
if (iolog_write(&closure->iolog_files[iofd], data.data, data.len,
674+
&errstr) == -1) {
674675
sudo_warnx(U_("%s/%s: %s"), evlog->iolog_path, iolog_fd_to_name(iofd),
675676
errstr);
676677
goto bad;
677678
}
678679

679680
/* Write timing data. */
680-
if (!iolog_write(&closure->iolog_files[IOFD_TIMING], tbuf,
681-
(size_t)len, &errstr)) {
681+
if (iolog_write(&closure->iolog_files[IOFD_TIMING], tbuf,
682+
(size_t)len, &errstr) == -1) {
682683
sudo_warnx(U_("%s/%s: %s"), evlog->iolog_path,
683684
iolog_fd_to_name(IOFD_TIMING), errstr);
684685
goto bad;
@@ -714,8 +715,8 @@ store_winsize_local(const ChangeWindowSize *msg, const uint8_t *buf,
714715
}
715716

716717
/* Write timing data. */
717-
if (!iolog_write(&closure->iolog_files[IOFD_TIMING], tbuf,
718-
(size_t)len, &errstr)) {
718+
if (iolog_write(&closure->iolog_files[IOFD_TIMING], tbuf,
719+
(size_t)len, &errstr) == -1) {
719720
sudo_warnx(U_("%s/%s: %s"), closure->evlog->iolog_path,
720721
iolog_fd_to_name(IOFD_TIMING), errstr);
721722
goto bad;
@@ -749,8 +750,8 @@ store_suspend_local(const CommandSuspend *msg, const uint8_t *buf,
749750
}
750751

751752
/* Write timing data. */
752-
if (!iolog_write(&closure->iolog_files[IOFD_TIMING], tbuf,
753-
(size_t)len, &errstr)) {
753+
if (iolog_write(&closure->iolog_files[IOFD_TIMING], tbuf,
754+
(size_t)len, &errstr) == -1) {
754755
sudo_warnx(U_("%s/%s: %s"), closure->evlog->iolog_path,
755756
iolog_fd_to_name(IOFD_TIMING), errstr);
756757
goto bad;

0 commit comments

Comments
 (0)