1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Add range test for device number

Check the output of atoi is in valid range.
This commit is contained in:
Zdenek Kabelac 2012-02-08 12:48:14 +00:00
parent eae8784ae2
commit 7ffca95bb6
2 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.91 - Version 2.02.91 -
=================================== ===================================
Add range test for device number in _scan_proc_dev().
Use signed long for sysconf() call in cmirrord. Use signed long for sysconf() call in cmirrord.
Do not write in front of log buffer in print_log(). Do not write in front of log buffer in print_log().
Add boundary test for number of mirror devs and logs. Add boundary test for number of mirror devs and logs.

View File

@ -226,7 +226,7 @@ static int _scan_proc_dev(const char *proc, const struct dm_config_node *cn)
/* If it's not a number it may be name of section */ /* If it's not a number it may be name of section */
line_maj = atoi(((char *) (line + i))); line_maj = atoi(((char *) (line + i)));
if (!line_maj) { if ((line_maj <= 0) || (line_maj >= NUMBER_OF_MAJORS)) {
blocksection = (line[i] == 'B') ? 1 : 0; blocksection = (line[i] == 'B') ? 1 : 0;
continue; continue;
} }