From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 5EE41385E006 for ; Fri, 27 Mar 2020 14:52:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5EE41385E006 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 0EA463000735; Fri, 27 Mar 2020 15:52:36 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id ED4A7401443C; Fri, 27 Mar 2020 15:52:35 +0100 (CET) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [PATCH] debuginfod: Disallow --port=0. Date: Fri, 27 Mar 2020 15:52:34 +0100 Message-Id: <20200327145234.4624-1-mark@klomp.org> X-Mailer: git-send-email 2.18.2 X-Spam-Status: No, score=-22.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Mar 2020 14:52:38 -0000 When starting debuginfod with --port=0 it would start using a random port (possibly different for ipv4 and ipv6). This seems to be an accidental and not very useful functionality. Just produce an error when started with --port=0. https://sourceware.org/bugzilla/show_bug.cgi?id=25728 Signed-off-by: Mark Wielaard --- debuginfod/ChangeLog | 4 ++++ debuginfod/debuginfod.cxx | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 58ba85cf..018d62f6 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,7 @@ +2020-03-27 Mark Wielaard + + * debuginfod.cxx (parse_opt): Check port is not zero. + 2020-03-26 Frank Ch. Eigler * debuginfod.cxx (parse_opt): For -U, prefer dpkg-deb diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 9e8d5560..84eeb78d 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -422,7 +422,8 @@ parse_opt (int key, char *arg, case 'v': verbose ++; break; case 'd': db_path = string(arg); break; case 'p': http_port = (unsigned) atoi(arg); - if (http_port > 65535) argp_failure(state, 1, EINVAL, "port number"); + if (http_port == 0 || http_port > 65535) + argp_failure(state, 1, EINVAL, "port number"); break; case 'F': scan_files = true; break; case 'R': -- 2.18.2