[lib-result] Check validity of the request type
This commit is contained in:
parent
d995cdfc7d
commit
b39ccb8f1e
|
@ -93,7 +93,7 @@ owl_result* owl_fill_result(char *csv)
|
|||
long longfield ; // Return value of owl_read_long_field()
|
||||
owl_result *result = NULL ;
|
||||
|
||||
result = malloc(sizeof(owl_result)) ;
|
||||
result = malloc(sizeof(*result)) ;
|
||||
if (! result)
|
||||
{
|
||||
perror("Cannot allocate memory") ;
|
||||
|
@ -128,6 +128,12 @@ owl_result* owl_fill_result(char *csv)
|
|||
"Error reading the request type from the CSV string!\n") ;
|
||||
goto error ;
|
||||
}
|
||||
if (! OWL_IS_REQUEST_TYPE(longfield))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"The request type read (%ld) is invalid!\n", longfield) ;
|
||||
goto error ;
|
||||
}
|
||||
result->request_type = longfield ;
|
||||
|
||||
/* Timestamp */
|
||||
|
|
Loading…
Reference in New Issue