Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
6ed21a4a
Commit
6ed21a4a
authored
5 years ago
by
Michael Davis
Browse files
Options
Downloads
Patches
Plain Diff
[cta-admin] Check that uint64 arguments are not negative numbers
parent
1cb2013a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmdline/CtaAdminCmd.cpp
+3
-1
3 additions, 1 deletion
cmdline/CtaAdminCmd.cpp
with
3 additions
and
1 deletion
cmdline/CtaAdminCmd.cpp
+
3
−
1
View file @
6ed21a4a
...
...
@@ -363,9 +363,11 @@ void CtaAdminCmd::addOption(const Option &option, const std::string &value)
}
case
Option
::
OPT_UINT
:
try
{
auto
key
=
uint64Options
.
at
(
option
.
get_key
());
int64_t
val_int
=
std
::
stol
(
value
);
if
(
val_int
<
0
)
throw
std
::
out_of_range
(
"value is negative"
);
auto
new_opt
=
admincmd_ptr
->
add_option_uint64
();
new_opt
->
set_key
(
key
);
new_opt
->
set_value
(
std
::
stoul
(
value
)
);
new_opt
->
set_value
(
val_int
);
break
;
}
catch
(
std
::
invalid_argument
&
)
{
throw
std
::
runtime_error
(
value
+
" is not a valid uint64: "
+
option
.
help
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment