From: Frank Ch. Eigler Date: Tue, 24 Mar 2020 19:01:58 +0000 (-0400) Subject: debuginfod-find: Correct error check for -v source combo X-Git-Tag: elfutils-0.179~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7316d9ff9ec78c41e321c8327b90e6e77517312;p=thirdparty%2Felfutils.git debuginfod-find: Correct error check for -v source combo Hardcoding argv[2] is wrong in presence of -v option. Code immediately following did the correct argv[] indexing already. Signed-off-by: Frank Ch. Eigler --- diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 2410430c2..00e7ec632 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,8 @@ +2020-03-24 Frank Ch. Eigler + + * debuginfod-find.c (main): Correct /source full-pathness check for + "debuginfod-find -v source deadbeef /pathname" case. + 2020-03-22 Frank Ch. Eigler * debuginfod-client.c (struct debuginfod_client): Add url field. diff --git a/debuginfod/debuginfod-find.c b/debuginfod/debuginfod-find.c index 787779c76..400c26822 100644 --- a/debuginfod/debuginfod-find.c +++ b/debuginfod/debuginfod-find.c @@ -1,6 +1,6 @@ /* Command-line frontend for retrieving ELF / DWARF / source files from the debuginfod. - Copyright (C) 2019 Red Hat, Inc. + Copyright (C) 2019-2020 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -121,7 +121,7 @@ main(int argc, char** argv) &cache_name); else if (strcmp(argv[remaining], "source") == 0) { - if (remaining+2 == argc || argv[3][0] != '/') + if (remaining+2 == argc || argv[remaining+2][0] != '/') { fprintf(stderr, "If FILETYPE is \"source\" then absolute /FILENAME must be given\n"); return 1;