[Bug,debuginfod/31637] segmentation fault when calling 'debuginfod-find -v'

Message ID bug-31637-10460-ZRDVBLcpEQ@http.sourceware.org/bugzilla/
State Committed
Headers
Series [Bug,debuginfod/31637] segmentation fault when calling 'debuginfod-find -v' |

Commit Message

dodji at seketeli dot org April 12, 2024, 9:41 p.m. UTC
  https://sourceware.org/bugzilla/show_bug.cgi?id=31637

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |fche at redhat dot com

--- Comment #1 from Frank Ch. Eigler <fche at redhat dot com> ---
Fixed with commit d9f38a7052c22c7762aa5b98b401e8a324336bce, committed as
obvious.



and a little test.
  

Patch

diff --git a/debuginfod/debuginfod-find.c b/debuginfod/debuginfod-find.c
index 307310988c4c..080dd8f2c6a3 100644
--- a/debuginfod/debuginfod-find.c
+++ b/debuginfod/debuginfod-find.c
@@ -136,7 +136,7 @@  main(int argc, char** argv)
   int remaining;
   (void) argp_parse (&argp, argc, argv, ARGP_IN_ORDER|ARGP_NO_ARGS,
&remaining, NULL);

-  if (argc < 2 || remaining+1 == argc) /* no arguments or at least two
non-option words */
+  if (argc < 2 || remaining+1 >= argc) /* no arguments or at least two
non-option words */