]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: refuse skip parameter for sd_journal_next_skip() larger than INT_MAX
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 9 Nov 2020 06:23:32 +0000 (15:23 +0900)
committerLennart Poettering <lennart@poettering.net>
Tue, 10 Nov 2020 12:14:42 +0000 (13:14 +0100)
Fixes #17502.

man/sd_journal_next.xml
src/journal/sd-journal.c

index 5f476fe3dfc57eeb6a4d7fa715e7e6f0965615a9..56083317371cd6d94c1d0478e17fc4a75296a3cf 100644 (file)
@@ -78,9 +78,9 @@
     the read pointer back one entry.</para>
 
     <para><function>sd_journal_next_skip()</function> and
-    <function>sd_journal_previous_skip()</function> advance/set back
-    the read pointer by multiple entries at once, as specified in the
-    <varname>skip</varname> parameter.</para>
+    <function>sd_journal_previous_skip()</function> advance/set back the read pointer by multiple
+    entries at once, as specified in the <varname>skip</varname> parameter. The <varname>skip</varname>
+    parameter must be less than or equal to 2147483647 (2^31-1).</para>
 
     <para>The journal is strictly ordered by reception time, and hence
     advancing to the next entry guarantees that the entry then
index dbbf919b7508bc6a87ab796f047db1031161d640..cb1ab88ca57d1ba38cb3731756dd843a50a54074 100644 (file)
@@ -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