Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
c73938f3
Commit
c73938f3
authored
Jul 14, 2010
by
Leigh B Stoller
Browse files
Add better sanity checking to the state in dostate(), before we send
it to the event system.
parent
b095d479
Changes
1
Hide whitespace changes
Inline
Side-by-side
tmcd/tmcd.c
View file @
c73938f3
...
...
@@ -4275,6 +4275,7 @@ COMMAND_PROTOTYPE(donseconfigs)
COMMAND_PROTOTYPE
(
dostate
)
{
char
newstate
[
128
];
/* More then we will ever need */
int
i
;
#ifdef EVENTSYS
address_tuple_t
tuple
;
#endif
...
...
@@ -4291,6 +4292,17 @@ COMMAND_PROTOTYPE(dostate)
error
(
"DOSTATE: %s: Bad arguments
\n
"
,
reqp
->
nodeid
);
return
1
;
}
/*
* Sanity check. No special or weird chars.
*/
for
(
i
=
0
;
i
<
strlen
(
newstate
);
i
++
)
{
if
(
!
(
isalnum
(
newstate
[
i
])
||
newstate
[
i
]
==
'_'
||
newstate
[
i
]
==
'-'
))
{
error
(
"DOSTATE: %s: Bad state name
\n
"
,
reqp
->
nodeid
);
return
1
;
}
}
#ifdef EVENTSYS
/*
* Send the state out via an event
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment