ncurses/ncurses-5.9-fortify.dif

24 lines
719 B
Plaintext

--- progs/infocmp.c
+++ progs/infocmp.c 2012-03-05 11:11:08.300796156 +0000
@@ -1089,9 +1089,10 @@ dump_initializers(TERMTYPE *term)
if (VALID_STRING(term->Strings[n])) {
tp = buf;
+#define TP_LIMIT ((MAX_STRING - 4) - (size_t)(tp - buf))
*tp++ = '"';
for (sp = term->Strings[n];
- *sp != 0 && (tp - buf) < MAX_STRING - 6;
+ *sp != 0 && TP_LIMIT > 2;
sp++) {
if (isascii(UChar(*sp))
&& isprint(UChar(*sp))
@@ -1099,7 +1100,7 @@ dump_initializers(TERMTYPE *term)
&& *sp != '"')
*tp++ = *sp;
else {
- _nc_SPRINTF(tp, _nc_SLIMIT(MAX_STRING) "\\%03o", UChar(*sp));
+ _nc_SPRINTF(tp, _nc_SLIMIT(TP_LIMIT) "\\%03o", UChar(*sp));
tp += 4;
}
}