mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
*sum: protect names against argv[0] (#11375)
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user