- rcfile.c:parse_rcfile() - Don't use i for both for loop and atoi(), fixes lots of potential crashes, 1st reported by Jean-Philippe Gue'rard
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1113 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
79dcc475a7
commit
1596d38698
|
@ -8,6 +8,8 @@ CVS code -
|
||||||
- nano.c:
|
- nano.c:
|
||||||
main()
|
main()
|
||||||
- Put NANO_SMALL defines around toggle pointer (noticed by Jordi);
|
- Put NANO_SMALL defines around toggle pointer (noticed by Jordi);
|
||||||
|
- rcfile.c:
|
||||||
|
|
||||||
- utils.c:
|
- utils.c:
|
||||||
stristr() - Defined regardless of NANO_SMALL (noticed by Jordi).
|
stristr() - Defined regardless of NANO_SMALL (noticed by Jordi).
|
||||||
|
|
||||||
|
|
14
rcfile.c
14
rcfile.c
|
@ -304,7 +304,7 @@ void parse_colors(FILE * rcstream, char *buf, char *ptr)
|
||||||
void parse_rcfile(FILE * rcstream)
|
void parse_rcfile(FILE * rcstream)
|
||||||
{
|
{
|
||||||
char *buf, *ptr, *keyword, *option;
|
char *buf, *ptr, *keyword, *option;
|
||||||
int set = 0, i;
|
int set = 0, i, j;
|
||||||
|
|
||||||
buf = charalloc(1024);
|
buf = charalloc(1024);
|
||||||
while (fgets(buf, 1023, rcstream) > 0) {
|
while (fgets(buf, 1023, rcstream) > 0) {
|
||||||
|
@ -382,22 +382,22 @@ void parse_rcfile(FILE * rcstream)
|
||||||
if (!strcasecmp(rcopts[i].name, "fill")) {
|
if (!strcasecmp(rcopts[i].name, "fill")) {
|
||||||
#ifndef DISABLE_WRAPJUSTIFY
|
#ifndef DISABLE_WRAPJUSTIFY
|
||||||
|
|
||||||
if ((i = atoi(option)) < MIN_FILL_LENGTH) {
|
if ((j = atoi(option)) < MIN_FILL_LENGTH) {
|
||||||
rcfile_error(_
|
rcfile_error(_
|
||||||
("requested fill size %d too small"),
|
("requested fill size %d too small"),
|
||||||
i);
|
j);
|
||||||
} else
|
} else
|
||||||
fill = i;
|
fill = j;
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
if (!strcasecmp(rcopts[i].name, "tabsize"))
|
if (!strcasecmp(rcopts[i].name, "tabsize"))
|
||||||
{
|
{
|
||||||
if ((i = atoi(option)) <= 0) {
|
if ((j = atoi(option)) <= 0) {
|
||||||
rcfile_error(_
|
rcfile_error(_
|
||||||
("requested tab size %d too small"),
|
("requested tab size %d too small"),
|
||||||
i);
|
j);
|
||||||
} else {
|
} else {
|
||||||
tabsize = i;
|
tabsize = j;
|
||||||
}
|
}
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in New Issue