changed all 'sprintf' calls to 'snprintf'
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@58 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
715e7dd403
commit
6af1431eaa
36
nano.c
36
nano.c
|
@ -1039,7 +1039,7 @@ void exit_spell(char *tmpfilename, char *foo)
|
||||||
int do_oldspell(void)
|
int do_oldspell(void)
|
||||||
{
|
{
|
||||||
char *temp, *foo;
|
char *temp, *foo;
|
||||||
int i;
|
int i, size;
|
||||||
|
|
||||||
if ((temp = tempnam(0, "nano.")) == NULL) {
|
if ((temp = tempnam(0, "nano.")) == NULL) {
|
||||||
statusbar(_("Could not create a temporary filename: %s"),
|
statusbar(_("Could not create a temporary filename: %s"),
|
||||||
|
@ -1050,14 +1050,16 @@ int do_oldspell(void)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (alt_speller) {
|
if (alt_speller) {
|
||||||
foo = nmalloc(strlen(temp) + strlen(alt_speller) + 2);
|
size = strlen(temp) + strlen(alt_speller) + 2;
|
||||||
sprintf(foo, "%s %s", alt_speller, temp);
|
foo = nmalloc(size);
|
||||||
|
snprintf(foo, size, "%s %s", alt_speller, temp);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* For now, we only try ispell because we're not capable of
|
/* For now, we only try ispell because we're not capable of
|
||||||
handling the normal spell program (yet...) */
|
handling the normal spell program (yet...) */
|
||||||
foo = nmalloc(strlen(temp) + 8);
|
size = strlen(temp) + 8;
|
||||||
sprintf(foo, "ispell %s", temp);
|
foo = nmalloc(size);
|
||||||
|
snprintf(foo, size, "ispell %s", temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
endwin();
|
endwin();
|
||||||
|
@ -1089,7 +1091,7 @@ int do_oldspell(void)
|
||||||
int do_spell(void)
|
int do_spell(void)
|
||||||
{
|
{
|
||||||
char *temp, *foo;
|
char *temp, *foo;
|
||||||
int i;
|
int i, size;
|
||||||
|
|
||||||
if ((temp = tempnam(0, "nano.")) == NULL) {
|
if ((temp = tempnam(0, "nano.")) == NULL) {
|
||||||
statusbar(_("Could not create a temporary filename: %s"),
|
statusbar(_("Could not create a temporary filename: %s"),
|
||||||
|
@ -1100,14 +1102,16 @@ int do_spell(void)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (alt_speller) {
|
if (alt_speller) {
|
||||||
foo = nmalloc(strlen(temp) + strlen(alt_speller) + 2);
|
size = strlen(temp) + strlen(alt_speller) + 2;
|
||||||
sprintf(foo, "%s %s", alt_speller, temp);
|
foo = nmalloc(size);
|
||||||
|
snprintf(foo, size, "%s %s", alt_speller, temp);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* For now, we only try ispell because we're not capable of
|
/* For now, we only try ispell because we're not capable of
|
||||||
handling the normal spell program (yet...) */
|
handling the normal spell program (yet...) */
|
||||||
foo = nmalloc(strlen(temp) + 8);
|
size = strlen(temp) + 8;
|
||||||
sprintf(foo, "ispell %s", temp);
|
foo = nmalloc(size);
|
||||||
|
snprintf(foo, size, "ispell %s", temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
endwin();
|
endwin();
|
||||||
|
@ -1533,22 +1537,22 @@ void help_init(void)
|
||||||
|
|
||||||
/* Now add our shortcut info */
|
/* Now add our shortcut info */
|
||||||
for (i = 0; i < MAIN_LIST_LEN; i++) {
|
for (i = 0; i < MAIN_LIST_LEN; i++) {
|
||||||
sofar = sprintf(buf, "^%c ", main_list[i].val + 64);
|
sofar = snprintf(buf, BUFSIZ, "^%c ", main_list[i].val + 64);
|
||||||
|
|
||||||
if (main_list[i].misc1 > KEY_F0 && main_list[i].misc1 <= KEY_F(64))
|
if (main_list[i].misc1 > KEY_F0 && main_list[i].misc1 <= KEY_F(64))
|
||||||
sofar += sprintf(&buf[sofar], "(F%d) ",
|
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(F%d) ",
|
||||||
main_list[i].misc1 - KEY_F0);
|
main_list[i].misc1 - KEY_F0);
|
||||||
else
|
else
|
||||||
sofar += sprintf(&buf[sofar], " ");
|
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, " ");
|
||||||
|
|
||||||
if (main_list[i].altval > 0)
|
if (main_list[i].altval > 0)
|
||||||
sofar += sprintf(&buf[sofar], "(@%c) ",
|
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(@%c) ",
|
||||||
main_list[i].altval - 32);
|
main_list[i].altval - 32);
|
||||||
else
|
else
|
||||||
sofar += sprintf(&buf[sofar], " ");
|
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, " ");
|
||||||
|
|
||||||
if (main_list[i].help != NULL)
|
if (main_list[i].help != NULL)
|
||||||
sprintf(&buf[sofar], "%s\n", main_list[i].help);
|
snprintf(&buf[sofar], BUFSIZ - sofar, "%s\n", main_list[i].help);
|
||||||
|
|
||||||
strcat(help_text, buf);
|
strcat(help_text, buf);
|
||||||
}
|
}
|
||||||
|
|
4
search.c
4
search.c
|
@ -41,10 +41,10 @@
|
||||||
int search_init(int replacing)
|
int search_init(int replacing)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char buf[135];
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
if (last_search[0]) {
|
if (last_search[0]) {
|
||||||
sprintf(buf, " [%s]", last_search);
|
snprintf(buf, BUFSIZ, " [%s]", last_search);
|
||||||
} else {
|
} else {
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
4
winio.c
4
winio.c
|
@ -490,7 +490,7 @@ void bottombars(shortcut s[], int slen)
|
||||||
clear_bottomwin();
|
clear_bottomwin();
|
||||||
wmove(bottomwin, 1, 0);
|
wmove(bottomwin, 1, 0);
|
||||||
for (i = 0; i <= slen - 1; i += 2) {
|
for (i = 0; i <= slen - 1; i += 2) {
|
||||||
sprintf(keystr, "^%c", s[i].val + 64);
|
snprintf(keystr, 10, "^%c", s[i].val + 64);
|
||||||
onekey(keystr, s[i].desc);
|
onekey(keystr, s[i].desc);
|
||||||
|
|
||||||
for (j = 0; j < k; j++)
|
for (j = 0; j < k; j++)
|
||||||
|
@ -499,7 +499,7 @@ void bottombars(shortcut s[], int slen)
|
||||||
|
|
||||||
wmove(bottomwin, 2, 0);
|
wmove(bottomwin, 2, 0);
|
||||||
for (i = 1; i <= slen - 1; i += 2) {
|
for (i = 1; i <= slen - 1; i += 2) {
|
||||||
sprintf(keystr, "^%c", s[i].val + 64);
|
snprintf(keystr, 10, "^%c", s[i].val + 64);
|
||||||
onekey(keystr, s[i].desc);
|
onekey(keystr, s[i].desc);
|
||||||
|
|
||||||
for (j = 0; j < k; j++)
|
for (j = 0; j < k; j++)
|
||||||
|
|
Loading…
Reference in New Issue