mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8235489: handle return values of sscanf calls in hotspot
Reviewed-by: clanger, kbarrett
This commit is contained in:
parent
3fe949b2f4
commit
e5b0e366ea
2 changed files with 11 additions and 6 deletions
|
@ -380,10 +380,12 @@ static OracleCommand parse_command_name(const char * line, int* bytes_read) {
|
|||
|
||||
*bytes_read = 0;
|
||||
char command[33];
|
||||
int result = sscanf(line, "%32[a-z]%n", command, bytes_read);
|
||||
for (uint i = 0; i < ARRAY_SIZE(command_names); i++) {
|
||||
if (strcmp(command, command_names[i]) == 0) {
|
||||
return (OracleCommand)i;
|
||||
int matches = sscanf(line, "%32[a-z]%n", command, bytes_read);
|
||||
if (matches > 0) {
|
||||
for (uint i = 0; i < ARRAY_SIZE(command_names); i++) {
|
||||
if (strcmp(command, command_names[i]) == 0) {
|
||||
return (OracleCommand)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return UnknownCommand;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue