library: protect against large version numbers.
Linux release numbers are x.y.z we assumed but never protected against x> 0x7fff and y,z > 0xff before. Linux release in 1991, 1 major release per 6 years so we're fine until 7452, unless they do way too many minor rels (max being 39)
This commit is contained in:
@ -29,7 +29,7 @@ __BEGIN_DECLS
|
||||
int procps_linux_version(void);
|
||||
|
||||
/* Convenience macros for composing/decomposing version codes */
|
||||
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
|
||||
#define LINUX_VERSION(x,y,z) (0x10000*((x)&0x7fff) + 0x100*((y)&0xff) + (z)&0xff)
|
||||
#define LINUX_VERSION_MAJOR(x) (((x)>>16) & 0xFF)
|
||||
#define LINUX_VERSION_MINOR(x) (((x)>> 8) & 0xFF)
|
||||
#define LINUX_VERSION_PATCH(x) ( (x) & 0xFF)
|
||||
|
Reference in New Issue
Block a user