protover: reject unexpected commas

Consistently reject extra commas, instead of only rejecting leading
commas.

Fix on b2b2e1c7f2.
Fixes #27194; bugfix on 0.2.9.4-alpha.
This commit is contained in:
cypherpunks
2018-08-17 22:45:33 +00:00
parent c2b95da4d4
commit 32b33c0d21
3 changed files with 9 additions and 1 deletions
+3
View File
@@ -0,0 +1,3 @@
o Minor bugfixes (protover):
- Consistently reject extra commas, instead of only rejecting leading commas.
Fixes bug 27194; bugfix on 0.2.9.4-alpha.
+2 -1
View File
@@ -245,7 +245,8 @@ parse_single_entry(const char *s, const char *end_of_entry)
}
s = comma;
while (*s == ',' && s < end_of_entry)
// Skip the comma separator between ranges. Don't ignore a trailing comma.
if (s < (end_of_entry - 1))
++s;
}
+4
View File
@@ -572,6 +572,10 @@ test_protover_vote_roundtrip(void *args)
{ "N-1=1,2", "N-1=1-2" },
{ "-1=4294967295", NULL },
{ "-1=3", "-1=3" },
{ "Foo=,", NULL },
{ "Foo=,1", NULL },
{ "Foo=1,,3", NULL },
{ "Foo=1,3,", NULL },
/* junk. */
{ "!!3@*", NULL },
/* Missing equals sign */