mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-22 03:02:06 +03:00
* utilvfs.c (vfs_parse_ls_lga): Handle device without whitespace(s)
between major and minor.
This commit is contained in:
parent
02db8a9660
commit
722f4e684a
@ -1,5 +1,8 @@
|
|||||||
2004-03-07 Andrew V. Samoilov <sav@bcs.zp.ua>
|
2004-03-07 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||||
|
|
||||||
|
* utilvfs.c (vfs_parse_ls_lga): Handle device without whitespace(s)
|
||||||
|
between major and minor.
|
||||||
|
|
||||||
* direntry.c (vfs_s_resolve_symlink): Check vfs_s_fullpath()
|
* direntry.c (vfs_s_resolve_symlink): Check vfs_s_fullpath()
|
||||||
return value to avoid NULL dereference.
|
return value to avoid NULL dereference.
|
||||||
Reported by wwp <subscript@free.fr>.
|
Reported by wwp <subscript@free.fr>.
|
||||||
|
@ -748,12 +748,17 @@ vfs_parse_ls_lga (const char *p, struct stat *s, char **filename,
|
|||||||
if (S_ISCHR (s->st_mode) || S_ISBLK (s->st_mode)) {
|
if (S_ISCHR (s->st_mode) || S_ISBLK (s->st_mode)) {
|
||||||
int maj, min;
|
int maj, min;
|
||||||
|
|
||||||
if (!is_num (idx2) || sscanf (columns[idx2], " %d,", &maj) != 1)
|
/* Corner case: there is no whitespace(s) between maj & min */
|
||||||
goto error;
|
if (!is_num (idx2) && idx2 == 2) {
|
||||||
|
if (!is_num (++idx2) || sscanf (columns[idx2], " %d,%d", &min, &min) != 2)
|
||||||
if (!is_num (++idx2) || sscanf (columns[idx2], " %d", &min) != 1)
|
goto error;
|
||||||
goto error;
|
} else {
|
||||||
|
if (!is_num (idx2) || sscanf (columns[idx2], " %d,", &maj) != 1)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if (!is_num (++idx2) || sscanf (columns[idx2], " %d", &min) != 1)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
||||||
s->st_rdev = ((maj & 0xff) << 8) | (min & 0xffff00ff);
|
s->st_rdev = ((maj & 0xff) << 8) | (min & 0xffff00ff);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user