summaryrefslogtreecommitdiffstats
path: root/generic/tkConfig.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2020-09-08 19:47:11 (GMT)
committerfvogel <fvogelnew1@free.fr>2020-09-08 19:47:11 (GMT)
commit1cebfa6aa3095dcdb4dbcf81186a0090a5ef2b8b (patch)
tree481c22acf0b033dc02db8f05a1badbc0273f918e /generic/tkConfig.c
parenta56a753b41381943366da4d0bfbe307b14ad3eb6 (diff)
downloadtk-1cebfa6aa3095dcdb4dbcf81186a0090a5ef2b8b.zip
tk-1cebfa6aa3095dcdb4dbcf81186a0090a5ef2b8b.tar.gz
tk-1cebfa6aa3095dcdb4dbcf81186a0090a5ef2b8b.tar.bz2
Fix [6c2425f92e]: UBSan error in Tk_FreeSavedOptions(). Thanks to Christopher Chavez.
Diffstat (limited to 'generic/tkConfig.c')
-rw-r--r--generic/tkConfig.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index a752674..7e0943d 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -1500,9 +1500,8 @@ Tk_FreeSavedOptions(
Tk_FreeSavedOptions(savePtr->nextPtr);
ckfree(savePtr->nextPtr);
}
- for (count = savePtr->numItems,
- savedOptionPtr = &savePtr->items[savePtr->numItems-1];
- count > 0; count--, savedOptionPtr--) {
+ for (count = savePtr->numItems; count > 0; count--) {
+ savedOptionPtr = &savePtr->items[count-1];
if (savedOptionPtr->optionPtr->flags & OPTION_NEEDS_FREEING) {
FreeResources(savedOptionPtr->optionPtr, savedOptionPtr->valuePtr,
(char *) &savedOptionPtr->internalForm, savePtr->tkwin);