*sum: protect names against argv[0] (#11375)

This commit is contained in:
oech3
2026-03-17 23:08:44 +01:00
committed by GitHub
parent e37c158aab
commit 57f69addb6
4 changed files with 6 additions and 3 deletions
+1
View File
@@ -26,4 +26,5 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
#[inline]
pub fn uu_app() -> Command {
standalone_checksum_app_with_length(translate!("b2sum-about"), translate!("b2sum-usage"))
.name("b2sum")
}
+2 -1
View File
@@ -48,6 +48,7 @@ macro_rules! declare_standalone {
::uucore::translate!(concat!($bin, "-about")),
::uucore::translate!(concat!($bin, "-usage")),
)
.name($bin)
}
};
}
@@ -96,7 +97,7 @@ pub fn standalone_main(algo: AlgoKind, cmd: Command, args: impl uucore::Args) ->
/// Base command processing for all the checksum executables.
pub fn default_checksum_app(about: String, usage: String) -> Command {
Command::new(util_name())
Command::new("")
.version(crate_version!())
.help_template(localized_help_template(util_name()))
.about(about)
+1
View File
@@ -118,6 +118,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
pub fn uu_app() -> Command {
default_checksum_app(translate!("cksum-about"), translate!("cksum-usage"))
.name("cksum")
.with_algo()
.with_untagged()
.with_tag(true)
+2 -2
View File
@@ -137,9 +137,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
}
pub fn uu_app() -> Command {
Command::new(uucore::util_name())
Command::new("sum")
.version(uucore::crate_version!())
.help_template(uucore::localized_help_template(uucore::util_name()))
.help_template(uucore::localized_help_template("sum"))
.override_usage(format_usage(&translate!("sum-usage")))
.about(translate!("sum-about"))
.infer_long_args(true)