web100clt.c: make results parsing more robust #217
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Do not assume that the first line we receive contains a space
Do not assume that the first line we receive contains an integer
Be robust to the case where input is an empty string
Do not assume that after the first token delimited by space we will find a second token delimited by newline
Tested under the following conditions:
a)
web100clt -n ndt.iupui.mlab1.trn01.measurement-lab.org
that sends back all variables and checked via printf() that the variables that are parsed by the new code are the ones received in resultstrb)
web100clt -n neubot.mlab.mlab1.mil01.measurement-lab.org
that at the moment is running botticelli v0.0.5 (which is buggy and doesn't send any MSG_RESULTS messages) and make sure it does not crashc)
web100clt -n neubot.mlab.mlab1.trn01.measurement-lab.org
that at the moment is running botticelli v0.0.6 (which sends a single dummy variable not considered by NDT) and make sure it doesn't crashNote that a) and c) did not changed after this patch. What this patch changes is the behavior in case b).
[Edit: forgot to mention that, when I tested, in my NDT tree there was #216 applied, otherwise b) and c) would have failed due to segmentation fault caused by accessing a non-initialized string.]
xref: neubot/botticelli#18.