diff --git a/fs/tmpfs/fs_tmpfs.c b/fs/tmpfs/fs_tmpfs.c index 98995a39ba..01fae27f5a 100644 --- a/fs/tmpfs/fs_tmpfs.c +++ b/fs/tmpfs/fs_tmpfs.c @@ -298,6 +298,12 @@ static int tmpfs_realloc_file(FAR struct tmpfs_file_s *tfo, */ allocsize = newsize + CONFIG_FS_TMPFS_FILE_ALLOCGUARD; + if (allocsize < newsize) + { + /* There must have been an integer overflow */ + + return -ENOMEM; + } /* Realloc the file object */