]> git.sesse.net Git - ffmpeg/commitdiff
avutil/avsscanf: fix possible overreads when dealing with %c or %s
authorPaul B Mahol <onemda@gmail.com>
Wed, 2 Dec 2020 12:46:22 +0000 (13:46 +0100)
committerPaul B Mahol <onemda@gmail.com>
Wed, 2 Dec 2020 12:54:53 +0000 (13:54 +0100)
libavutil/avsscanf.c

index 850c117940ef327ca6e1ca3f24f9cef106bca864..b7f0f71c2d5e1837acb4d60a6d0135d8ce412eb4 100644 (file)
@@ -113,7 +113,7 @@ static int ffshgetc(FFFILE *f)
 }
 
 #define shlim(f, lim) ffshlim((f), (lim))
-#define shgetc(f) (((f)->rpos != (f)->shend) ? *(f)->rpos++ : ffshgetc(f))
+#define shgetc(f) (((f)->rpos < (f)->shend) ? *(f)->rpos++ : ffshgetc(f))
 #define shunget(f) ((f)->shend ? (void)(f)->rpos-- : (void)0)
 
 static const unsigned char table[] = { -1,