mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			storage: fix potential memory corruption and check return values
							parent
							
								
									e4e6c645fa
								
							
						
					
					
						commit
						5a9183c549
					
				| 
						 | 
					@ -936,7 +936,10 @@ int SPIFBlockDevice::_reset_flash_mem()
 | 
				
			||||||
                tr_error("Sending RST failed");
 | 
					                tr_error("Sending RST failed");
 | 
				
			||||||
                status = -1;
 | 
					                status = -1;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            _is_mem_ready();
 | 
					            if (false == _is_mem_ready()) {
 | 
				
			||||||
 | 
					                tr_error("Device not ready, write failed");
 | 
				
			||||||
 | 
					                status = -1;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2719,7 +2719,7 @@ void get_fileinfo (
 | 
				
			||||||
		if (wc == 0) { di = 0; break; }		/* Buffer overflow? */
 | 
							if (wc == 0) { di = 0; break; }		/* Buffer overflow? */
 | 
				
			||||||
		di += wc;
 | 
							di += wc;
 | 
				
			||||||
#else					/* ANSI/OEM output */
 | 
					#else					/* ANSI/OEM output */
 | 
				
			||||||
		if (di <= FF_SFN_BUF) fno->altname[di++] = (TCHAR)wc;	/* Store it without any conversion */
 | 
							if (di < FF_SFN_BUF) fno->altname[di++] = (TCHAR)wc;	/* Store it without any conversion */
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	fno->altname[di] = 0;	/* Terminate the SFN  (null string means SFN is invalid) */
 | 
						fno->altname[di] = 0;	/* Terminate the SFN  (null string means SFN is invalid) */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2481,7 +2481,7 @@ int lfs_deorphan(lfs_t *lfs) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    lfs_dir_t pdir = {.d.size = 0x80000000};
 | 
					    lfs_dir_t pdir = {.d.size = 0x80000000};
 | 
				
			||||||
    lfs_dir_t cwd = {.d.tail[0] = 0, .d.tail[1] = 1};
 | 
					    lfs_dir_t cwd = {.d.tail = {0,1}};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // iterate over all directory directory entries
 | 
					    // iterate over all directory directory entries
 | 
				
			||||||
    while (!lfs_pairisnull(cwd.d.tail)) {
 | 
					    while (!lfs_pairisnull(cwd.d.tail)) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue