From: Yu Watanabe Date: Mon, 9 Nov 2020 06:23:32 +0000 (+0900) Subject: journal: refuse skip parameter for sd_journal_next_skip() larger than INT_MAX X-Git-Tag: v247-rc2~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=41d544a1c124a63f94b571e5ed924c4fb03193bb;p=thirdparty%2Fsystemd.git journal: refuse skip parameter for sd_journal_next_skip() larger than INT_MAX Fixes #17502. --- diff --git a/man/sd_journal_next.xml b/man/sd_journal_next.xml index 5f476fe3dfc..56083317371 100644 --- a/man/sd_journal_next.xml +++ b/man/sd_journal_next.xml @@ -78,9 +78,9 @@ the read pointer back one entry. sd_journal_next_skip() and - sd_journal_previous_skip() advance/set back - the read pointer by multiple entries at once, as specified in the - skip parameter. + sd_journal_previous_skip() advance/set back the read pointer by multiple + entries at once, as specified in the skip parameter. The skip + parameter must be less than or equal to 2147483647 (2^31-1). The journal is strictly ordered by reception time, and hence advancing to the next entry guarantees that the entry then diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index dbbf919b750..cb1ab88ca57 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -883,6 +883,7 @@ static int real_journal_next_skip(sd_journal *j, direction_t direction, uint64_t assert_return(j, -EINVAL); assert_return(!journal_pid_changed(j), -ECHILD); + assert_return(skip <= INT_MAX, -ERANGE); if (skip == 0) { /* If this is not a discrete skip, then at least