[gnome-commander] gnome-cmd-advrename-lexer.ll: fix for format-overflow
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] gnome-cmd-advrename-lexer.ll: fix for format-overflow
- Date: Fri, 28 Apr 2017 21:37:05 +0000 (UTC)
commit 4486596f5a7b7a2eaa640c414383d97bdb65f0d2
Author: Mamoru TASAKA <mtasaka fedoraproject org>
Date: Thu Apr 20 00:15:19 2017 +0900
gnome-cmd-advrename-lexer.ll: fix for format-overflow
gnome-cmd-advrename-lexer.cc:806:21: error: '%i' directive writing between 1 and 11 bytes into a region
of size 7 [-Werror=format-overflow=]
In file included from /usr/include/stdio.h:939:0,
from gnome-cmd-advrename-lexer.cc:19:
/usr/include/bits/stdio2.h:34:43: note: '__builtin___sprintf_chk' output between 6 and 16 bytes into a
destination of size 9
This warning is from GCC 7
Well, this warning may be confusing, however this says that at the line
sprintf(p->counter.fmt,"%%0%ili",p->counter.prec);
p->counter.prec has the size 9, while %i may take 11 bytes, so "%%0%ili" may take at most 16 bytes
(including the terminating null character), so the buffer size may be insufficient.
src/gnome-cmd-advrename-lexer.ll | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/gnome-cmd-advrename-lexer.ll b/src/gnome-cmd-advrename-lexer.ll
index 24733de..a91b93b 100644
--- a/src/gnome-cmd-advrename-lexer.ll
+++ b/src/gnome-cmd-advrename-lexer.ll
@@ -81,7 +81,7 @@ struct CHUNK
int prec;
int init_step;
int init_prec;
- char fmt[9];
+ char fmt[16];
} counter;
struct
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]