Handle NULL version pointer
This commit is contained in:
parent
7c7ba729f5
commit
ee462d92e8
@ -14,6 +14,11 @@ version_parse(const char *version, int tuple[3])
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
if (version == NULL) {
|
||||
err("parse_version: version is NULL\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strlen(version) >= 64) {
|
||||
err("parse_version: version too long: %s\n", version);
|
||||
return -1;
|
||||
|
@ -21,6 +21,7 @@ int main(void)
|
||||
{ -1, "1", { 0, 0, 0 } },
|
||||
{ -1, "1.O.O", { 0, 0, 0 } },
|
||||
{ -1, "1.2.3rc", { 0, 0, 0 } },
|
||||
{ -1, NULL, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
int n = sizeof(cases) / sizeof(cases[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user