Bug#632457: mount.nfs segfaults with 2-component kernel version number (like 3.0)
Package: nfs-common
Version: 1:1.2.3-3
Severity: normal
Tags: upstream
mount.nfs segfaults if kernel version number does not contain
at least 3 components delimited with a dot.
The following patch fixes it somehow, but it's wrong because
it does not take into account that a dot may be part of, say,
debian release number like 3.0-debian3.0.1 for example.
--- nfs-utils-1.2.3.orig/utils/mount/version.h
+++ nfs-utils-1.2.3/utils/mount/version.h
@@ -38,13 +38,15 @@ static inline unsigned int linux_version
{
struct utsname my_utsname;
unsigned int p, q, r;
+ const char *rp;
if (uname(&my_utsname))
return 0;
p = atoi(strtok(my_utsname.release, "."));
q = atoi(strtok(NULL, "."));
- r = atoi(strtok(NULL, "."));
+ rp = strtok(NULL, ".");
+ r = rp ? atoi(rp) : 0;
return MAKE_VERSION(p, q, r);
}
Reply to: