From 11dd2625fe46d91aa1cec081ea482211f7bf8c82 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 9 Jul 2024 10:54:07 -0700 Subject: [PATCH] Fix bugs status in 1992/gson The change made was incomplete with the other changes in the commit that addressed the other bug status added (and the gets(3)/fgets(3) one that was modified). --- bugs.html | 17 ++++++++--------- bugs.md | 18 ++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/bugs.html b/bugs.html index f47eee293..e7e522ac6 100644 --- a/bugs.html +++ b/bugs.html @@ -1127,15 +1127,14 @@ entry itself. Can you fix the actual entry? You are welcome to try and do so.

STATUS: uses gets() - change to fgets() if possible

Source code: 1992/gson/gson.c

Information: 1992/gson/index.html

-

Cody changed it so that the buffer size is ARG_MAX+1 to try and get past the -problem of gets() being used in a more complex way. It is most unlikely that -the dictionary file will ever have a line longer than 256 but even so it would -be ideal if the code used fgets(3) instead. A tip on how gets(3) is being -used:

-

Previously it had a buffer size of 256 for reading in the dictionary lines. In this -entry gets(3) is used in a more complicated way: first m is set to *++p in -a for loop where p is argv. Later m is set to point to h which was of size -256. gets(3) is called as m = gets(m)) but trying to change it to use

+

This code uses gets(3) on a buffer size of 256 to read from the dictionary. It +is highly unlikely that a line in a dictionary file will be this long but it +could happen and it would be ideal if the code used fgets(3) instead. +Unfortunately with this entry it’s not as simple due to how gets(3) is used, +which can be described simply as: first m is set to *++p in a for loop where +p is argv. Later m is set to point to h which was of size 256. gets(3) +is called as m = gets(m)) but trying to change it to use fgets(3) breaks the +program.

STATUS: INABIAF - please DO NOT fix

On the other hand, the author noted the following bugs and limitations: