Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit b74db42

Browse files
geza-pycomamotl
andauthored
Fix integer overflow in filesystem stat implementation. Resolve #409. (#129)
Co-authored-by: Andreas Motl <andreas@hiveeyes.org>
1 parent 36b44d3 commit b74db42

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

esp32/littlefs/vfs_littlefs.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,9 @@ STATIC mp_obj_t littlefs_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_param) {
669669
else {
670670
t->items[6] = mp_obj_new_int_from_uint(0); // st_size
671671
}
672-
t->items[7] = MP_OBJ_NEW_SMALL_INT(seconds); // st_atime
673-
t->items[8] = MP_OBJ_NEW_SMALL_INT(seconds); // st_mtime
674-
t->items[9] = MP_OBJ_NEW_SMALL_INT(seconds); // st_ctime
672+
t->items[7] = mp_obj_new_int_from_uint(seconds); // st_atime
673+
t->items[8] = mp_obj_new_int_from_uint(seconds); // st_mtime
674+
t->items[9] = mp_obj_new_int_from_uint(seconds); // st_ctime
675675

676676
return MP_OBJ_FROM_PTR(t);
677677
}

extmod/vfs_fat.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,9 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
365365
t->items[4] = MP_OBJ_NEW_SMALL_INT(0); // st_uid
366366
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // st_gid
367367
t->items[6] = mp_obj_new_int_from_uint(fno.fsize); // st_size
368-
t->items[7] = MP_OBJ_NEW_SMALL_INT(seconds); // st_atime
369-
t->items[8] = MP_OBJ_NEW_SMALL_INT(seconds); // st_mtime
370-
t->items[9] = MP_OBJ_NEW_SMALL_INT(seconds); // st_ctime
368+
t->items[7] = mp_obj_new_int_from_uint(seconds); // st_atime
369+
t->items[8] = mp_obj_new_int_from_uint(seconds); // st_mtime
370+
t->items[9] = mp_obj_new_int_from_uint(seconds); // st_ctime
371371

372372
return MP_OBJ_FROM_PTR(t);
373373
}

0 commit comments

Comments
 (0)