tst_kvercmp: Do not segfault on short release number

Debian testing (jessie) has "3.14-2-amd' in the release string and
because of that all testcases that call tst_kvercmp() segfaults in
atoi(NULL).

So if there is no third number in the version string, we now assume
(possibly incorrectly) that it's zero. But at least these testcases runs
fine there.

There seems to be three number version as a part of the uname.version
string there but parsing that seems to be even more fragile.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/lib/tst_kvercmp.c b/lib/tst_kvercmp.c
index a950120..abdec12 100644
--- a/lib/tst_kvercmp.c
+++ b/lib/tst_kvercmp.c
@@ -47,10 +47,13 @@
 	r1 = strsep(&kver, ".");
 	r2 = strsep(&kver, ".");
 	r3 = strsep(&kver, ".");
-
 	*k1 = atoi(r1);
 	*k2 = atoi(r2);
-	*k3 = atoi(r3);
+
+	if (r3)
+		*k3 = atoi(r3);
+	else
+		*k3 = 0;
 }
 
 int tst_kvercmp(int r1, int r2, int r3)