Unverified Commit c188578f authored by Tobias Stoeckmann's avatar Tobias Stoeckmann Committed by GitHub
Browse files

Fix out of boundary access with exif (#617)



* Fix out of boundary access

The while-loop is not finished when pos is set to EXIF_MAX_DATA.
Instead, the loop continues and therefore tries to access data outside
of the array.

This is triggered when compiled with exif=1 and asan:

$ feh --draw-exif image.jpg

* Fixed formatting

No functional change but makes previous commit easier verifiable
(independent of tab space setup).

* Call break; instead of setting pos2 to a magic value

This is in line with the following else clause

* Another cosmetic adjustment

Co-authored-by: default avatarDaniel Friesel <derf@finalrewind.org>
parent 87d9b7ed
Loading
Loading
Loading
Loading
+15 −15
Original line number Diff line number Diff line
@@ -1189,11 +1189,11 @@ void feh_draw_exif(winwidget w)
				{
					pos = EXIF_MAX_DATA; /* all data seen */
					info_line[pos2] = '\0';
					break;
				}
				else
				{
					info_line[pos2] = '\0'; /* line finished, continue with next line*/

					pos++;
					break;
				}