I started to use the sscanf function to parse commands from serial port and found out that it does not work as it must do. Example:
int i, j = 0x1234; char c = '\0'; i = sscanf("anything", "%d%c", &j, &c);
As soon as I read my own question the answer came to me :-) I can detect errors in the input by checking if the c field has been modified by sscanf (since I cannot rely on the return value). It will do as a workaround. Clearly there is an error in the implementation of a library function. Hopefully, Keil Software will fix that soon.