Reword note about gets() in 1992/gson
This commit is contained in:
1 parent
6186baa8eb
commit
b9e3cc4357
1 file changed
+5
-4
+5
-4
@@ -16,13 +16,14 @@
|
|||||||
|
|
||||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) changed the buffer size
|
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) changed the buffer size
|
||||||
in such a way that gets() should be safe (theoretically) as it comes from the
|
in such a way that gets() should be safe (theoretically) as it comes from the
|
||||||
command line. Ideally `fgets()` would be used but this is a more problematic.
|
command line (though it can also read input from stdin after starting the
|
||||||
|
program). Ideally `fgets()` would be used but this is a more problematic.
|
||||||
Previously it had a buffer size of 256 which could easily overflow. In this
|
Previously it had a buffer size of 256 which could easily overflow. In this
|
||||||
entry `gets()` is used in a more complicated way: first `m` is set to `*++p` in
|
entry `gets()` 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
|
a for loop where `p` is argv. Later `m` is set to point to `h` which was of size
|
||||||
\256. `gets()` is called as `m = gets(m)`) but trying to change it to use fgets()
|
\256. `gets()` is called as `m = gets(m)`) but trying to change it to use
|
||||||
proved more a problem. Since the input must come from the command line Cody
|
fgets() proved more a problem. Since the input must come from the command line
|
||||||
changed the buffer size to `ARG_MAX+1` which should be enough (again
|
Cody changed the buffer size to `ARG_MAX+1` which should be enough (again
|
||||||
theoretically) especially since the command expects redirecting a dictionary
|
theoretically) especially since the command expects redirecting a dictionary
|
||||||
file as part of the command line. This also makes it possible for longer strings
|
file as part of the command line. This also makes it possible for longer strings
|
||||||
to be read (in case the `gets()` was not used in a loop). Thank you Cody for
|
to be read (in case the `gets()` was not used in a loop). Thank you Cody for
|
||||||
|
|||||||
Reference in new issue
Block a user