mirror of
				https://github.com/eledio-devices/thirdparty-littlefs.git
				synced 2025-10-31 08:42:40 +01:00 
			
		
		
		
	Set the limit, the cursor cannot be set to a negative number
This commit is contained in:
		
				
					committed by
					
						 Christopher Haster
						Christopher Haster
					
				
			
			
				
	
			
			
			
						parent
						
							ead50807f1
						
					
				
				
					commit
					b898977fd8
				
			
							
								
								
									
										13
									
								
								lfs.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								lfs.c
									
									
									
									
									
								
							| @@ -3066,9 +3066,18 @@ static lfs_soff_t lfs_file_rawseek(lfs_t *lfs, lfs_file_t *file, | |||||||
|     if (whence == LFS_SEEK_SET) { |     if (whence == LFS_SEEK_SET) { | ||||||
|         npos = off; |         npos = off; | ||||||
|     } else if (whence == LFS_SEEK_CUR) { |     } else if (whence == LFS_SEEK_CUR) { | ||||||
|         npos = file->pos + off; |         if ((lfs_soff_t)file->pos + off < 0) { | ||||||
|  |             return LFS_ERR_INVAL; | ||||||
|  |         } else { | ||||||
|  |             npos = file->pos + off; | ||||||
|  |         } | ||||||
|     } else if (whence == LFS_SEEK_END) { |     } else if (whence == LFS_SEEK_END) { | ||||||
|         npos = lfs_file_rawsize(lfs, file) + off; |         lfs_soff_t res = lfs_file_rawsize(lfs, file) + off; | ||||||
|  |         if (res < 0) { | ||||||
|  |             return LFS_ERR_INVAL; | ||||||
|  |         } else { | ||||||
|  |             npos = res; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (npos > lfs->file_max) { |     if (npos > lfs->file_max) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user