As the version is now being passed by user it should be checked if its numerical. We didn't need this before as version wasn't passed by used. So this is not a bug fix.
Signed-off-by: Anand Jain <anand.j...@oracle.com> --- utils.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils.c b/utils.c index 0e66e2b..216efa6 100644 --- a/utils.c +++ b/utils.c @@ -3119,14 +3119,18 @@ static int version_to_code(char *v) for (b[i] = strtok_r(v, ".", &save_b); b[i] != NULL; - b[i] = strtok_r(NULL, ".", &save_b)) + b[i] = strtok_r(NULL, ".", &save_b)) { + if (!is_numerical(b[i])) + return -EINVAL; i++; + } + if (b[1] == NULL) + return KERNEL_VERSION(atoi(b[0]), 0, 0); if (b[2] == NULL) return KERNEL_VERSION(atoi(b[0]), atoi(b[1]), 0); - else - return KERNEL_VERSION(atoi(b[0]), atoi(b[1]), atoi(b[2])); + return KERNEL_VERSION(atoi(b[0]), atoi(b[1]), atoi(b[2])); } static int get_kernel_code() -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html