Merge pull request #287 from emilytrau/heirloom-devtools-snprintf

Fix segfault in yacc
This commit is contained in:
fosslinux 2023-05-01 11:35:57 +00:00 committed by GitHub
commit d918b984ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
b0a53dfe0f4cd5b9d3c1a459560a957030e52839f29b0d378e5234bf412705d6 /usr/bin/yacc
9f5186c86f8a2c7a0eb39d11f7017fc70d5a3940d56c648f93f6a3189ac1d67f /usr/bin/yacc
0fa43f12e3e32987211a433a9692f939b2c5d0dc32cd5523f9ad50bb441ac580 /usr/bin/lex
ffe696afc1bda32a5f4035e29b3275cab73a27df7635ccbe02ed49a30374ccdd /usr/lib/mes/libl.a
bf3fb293f1ff89ee3dbcb08166c64b7a6793b49a12673d7633e3353ebea80d4d /yaccpar

View File

@ -1,5 +1,6 @@
SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
SPDX-License-Identifier: CDDL-1.0
@ -227,7 +228,7 @@ diff -U3 -r yacc/y1.c yacc/y1.c
- q = chcopy(q, L" (");
- swprintf(q, q + isize - sarr, L"%d)", -i);
+ q = chcopy(q, " (");
+ sprintf(q, q + isize - sarr, "%d)", -i);
+ snprintf(q, q + isize - sarr, "%d)", -i);
}
return (sarr);
}
@ -393,7 +394,7 @@ diff -U3 -r yacc/y2.c yacc/y2.c
lrprnt(); /* dump lhs, rhs */
- swprintf(actname, sizeof actname,
- L"$$%d", nprod);
+ sprintf(actname, sizeof actname,
+ snprintf(actname, sizeof actname,
+ "$$%d", nprod);
/*
* make it nonterminal