dashdemux: replace sscanf with strtoul
Submitted by Florin Apostol
gstmpdparser.c file uses sscanf(..., "%u", ...) to read numbers from the xml file. sscanf is unable to indicate the fact that the input string was completely parsed or not. For example, for the input "123xyz" the sscanf function will return 1 (it successfully read an integer).
A better function is strtol (and strtoul, etc). This has the ability to provide a pointer to the next unparsed character in string. Using this, we can detect if the original string was valid or not.
The question is how restrictive the parser should be? Where a number is expected in an xml attribute and a "123xyz" is provided, should the parser read and use 123 or it should signal an error? Currently it reads just 123 and no error or warnings are issued (provided it does not need to parse the attribute further than the number).
So, should we make the parser more restrictive or not?