[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/src chat_window.c,1.64,1.65 crash.c,1.13,1.14
From: |
Colin Leroy <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/src chat_window.c,1.64,1.65 crash.c,1.13,1.14 input_list.c,1.9,1.10 log_window.c,1.21,1.22 mem_util.c,1.2,1.3 plugin.c,1.11,1.12 service.c,1.15,1.16 speech.c,1.4,1.5 status.c,1.78,1.79 trigger.c,1.11,1.12 util.c,1.60,1.61 |
Date: |
Tue, 25 Mar 2003 17:06:15 -0500 |
Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv19967/src
Modified Files:
chat_window.c crash.c input_list.c log_window.c mem_util.c
plugin.c service.c speech.c status.c trigger.c util.c
Log Message:
sprintf => snprintf
strcat => strncat
Index: chat_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_window.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- chat_window.c 24 Mar 2003 22:42:41 -0000 1.64
+++ chat_window.c 25 Mar 2003 22:06:12 -0000 1.65
@@ -725,7 +725,8 @@
subsequent_act = first_act;
do {
- sprintf(buff, "%s:%s",
get_service_name(subsequent_act->service_id), subsequent_act->alias);
+ snprintf(buff, sizeof(buff), "%s:%s",
+ get_service_name(subsequent_act->service_id),
subsequent_act->alias);
button = gtk_menu_item_new_with_label(buff);
gtk_menu_append(GTK_MENU(submenu), button);
cwa = g_new0(chat_window_account, 1);
@@ -1725,7 +1726,7 @@
if (strlen(remote->nick) > 20) {
strncpy(buff, remote->nick, 17);
buff[17]='\0';
- strcat(buff, "...");
+ strcat(buff, "..."); /* buff is large enough */
} else
strcpy(buff, remote->nick);
Index: crash.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/crash.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- crash.c 23 Mar 2003 21:48:30 -0000 1.13
+++ crash.c 25 Mar 2003 22:06:13 -0000 1.14
@@ -538,7 +538,7 @@
*/
args[0] = argv0;
args[1] = "--crash";
- sprintf(buf, "%d,%d,%s", getppid(), sig, argv0);
+ snprintf(buf, sizeof(buf), "%d,%d,%s", getppid(), sig, argv0);
args[2] = buf;
args[3] = NULL;
Index: input_list.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/input_list.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- input_list.c 29 Jan 2003 19:19:22 -0000 1.9
+++ input_list.c 25 Mar 2003 22:06:13 -0000 1.10
@@ -168,17 +168,17 @@
{
case EB_INPUT_CHECKBOX:
{
- sprintf(key, "%s",
il->widget.checkbox.name);
- for( ptr=strchr(key, ' '); ptr;
ptr=strchr(ptr, ' '))
+ snprintf(key, sizeof(key), "%s",
il->widget.checkbox.name);
+ for( ptr=strchr(key, ' '); ptr && *ptr;
ptr=strchr(ptr, ' '))
*ptr='_';
- sprintf(value, "%i",
*il->widget.checkbox.value);
+ snprintf(value, sizeof(value), "%i",
*il->widget.checkbox.value);
vp=value_pair_add(vp, key, value);
}
break;
case EB_INPUT_ENTRY:
{
- sprintf(key, "%s",
il->widget.entry.name);
- for( ptr=strchr(key, ' '); ptr;
ptr=strchr(ptr, ' '))
+ snprintf(key, sizeof(key), "%s",
il->widget.entry.name);
+ for( ptr=strchr(key, ' '); ptr && *ptr;
ptr=strchr(ptr, ' '))
*ptr='_';
vp=value_pair_add(vp, key,
il->widget.entry.value);
}
@@ -206,8 +206,8 @@
eb_debug(DBG_CORE,
"checkbox.value is NULL\n");
break;
}
- sprintf(key, "%s",
il->widget.checkbox.name);
- for( ptr=strchr(key, ' '); ptr;
ptr=strchr(ptr, ' '))
+ snprintf(key, sizeof(key), "%s",
il->widget.checkbox.name);
+ for( ptr=strchr(key, ' '); ptr && *ptr;
ptr=strchr(ptr, ' '))
*ptr='_';
value=value_pair_get_value(vp, key);
@@ -217,7 +217,7 @@
* have been released. We're currently
in 0.4.2
*/
if(!value && il->widget.checkbox.label)
{
- sprintf(key, "%s",
il->widget.checkbox.label);
+ snprintf(key, sizeof(key),
"%s", il->widget.checkbox.label);
for( ptr=strchr(key, ' '); ptr;
ptr=strchr(ptr, ' '))
*ptr='_';
value=value_pair_get_value(vp,
key);
@@ -236,7 +236,7 @@
eb_debug(DBG_CORE, "entry.value
is NULL\n");
break;
}
- sprintf(key, "%s",
il->widget.entry.name);
+ snprintf(key, sizeof(key), "%s",
il->widget.entry.name);
for( ptr=strchr(key, ' '); ptr;
ptr=strchr(ptr, ' '))
*ptr='_';
value=value_pair_get_value(vp, key);
@@ -247,8 +247,8 @@
* have been released. We're currently
in 0.4.2
*/
if(!value && il->widget.entry.label) {
- sprintf(key, "%s",
il->widget.entry.label);
- for( ptr=strchr(key, ' '); ptr;
ptr=strchr(ptr, ' '))
+ snprintf(key, sizeof(key),
"%s", il->widget.entry.label);
+ for( ptr=strchr(key, ' '); ptr
&& *ptr; ptr=strchr(ptr, ' '))
*ptr='_';
value=value_pair_get_value(vp,
key);
}
Index: log_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/log_window.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- log_window.c 12 Mar 2003 14:17:13 -0000 1.21
+++ log_window.c 25 Mar 2003 22:06:13 -0000 1.22
@@ -362,9 +362,9 @@
gtk_window_set_position(GTK_WINDOW(lw->window), GTK_WIN_POS_MOUSE);
/* show who the conversation is with */
if (rc)
- sprintf(buffer, _("Past conversations with %s"), rc->nick);
+ snprintf(buffer, sizeof(buffer), _("Past conversations with %s"),
rc->nick);
else
- sprintf(buffer, _("Past conversation"));
+ snprintf(buffer, sizeof(buffer), _("Past conversation"));
gtk_window_set_title(GTK_WINDOW(lw->window), buffer);
gtk_container_set_border_width(GTK_CONTAINER(lw->window), 5);
Index: mem_util.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/mem_util.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mem_util.c 6 Feb 2003 08:45:28 -0000 1.2
+++ mem_util.c 25 Mar 2003 22:06:13 -0000 1.3
@@ -52,7 +52,7 @@
ay_free(string);
}
- strcat(new_string, append);
+ strcat(new_string, append); /* this one is safe */
return new_string;
}
Index: plugin.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/plugin.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- plugin.c 24 Mar 2003 10:31:35 -0000 1.11
+++ plugin.c 25 Mar 2003 22:06:13 -0000 1.12
@@ -162,7 +162,7 @@
eb_debug(DBG_CORE, "Calling plugins finish function\n");
error=epi->pi.finish();
if(error) {
- sprintf(buf, _("Unable to unload plugin %s; maybe it is
still in use?"), epi->name);
+ snprintf(buf, sizeof(buf), _("Unable to unload plugin
%s; maybe it is still in use?"), epi->name);
do_error_dialog(buf, _("Error"));
eb_debug(DBG_CORE, "<Plugin failed to unload\n");
return(-1);
@@ -198,7 +198,7 @@
PLUGIN_INFO *plugin_info=NULL;
eb_PLUGIN_INFO *epi=NULL;
- sprintf(full_path, "%s/%s", path, name);
+ snprintf(full_path, sizeof(full_path), "%s/%s", path, name);
eb_debug(DBG_CORE, "Opening module: %s\n", full_path);
Module = lt_dlopen(full_path);
eb_debug(DBG_CORE, "Module: %p\n", Module);
@@ -273,7 +273,7 @@
do {
if((dirp = opendir(cur_path)) == NULL)
{
- sprintf(buf, _("Cannot open module directory \"%s\"."),
cur_path);
+ snprintf(buf, sizeof(buf), _("Cannot open module
directory \"%s\"."), cur_path);
do_error_dialog(buf, _("Warning"));
buf[0] = '\0';
break;
@@ -283,7 +283,7 @@
{
if( dp == NULL )
{
- sprintf(buf, _("Looking for modules in %s"),
cur_path);
+ snprintf(buf, sizeof(buf), _("Looking for
modules in %s"), cur_path);
perror(buf);
continue;
}
@@ -374,7 +374,7 @@
if(!info->init) {
SetPluginInfo(info, name, NULL, PLUGIN_CANNOT_LOAD, _("No init
function defined"), NULL, FALSE);
lt_dlclose(Module);
- sprintf(buf, _("Utility module %s doesn't define an init
function; skipping it."), name);
+ snprintf(buf, sizeof(buf), _("Utility module %s doesn't define
an init function; skipping it."), name);
do_error_dialog(buf, _("Warning"));
return(-1);
}
Index: service.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/service.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- service.c 29 Jan 2003 19:19:23 -0000 1.15
+++ service.c 25 Mar 2003 22:06:13 -0000 1.16
@@ -159,7 +159,7 @@
eb_services[NUM_SERVICES].name = strdup(servicename);
eb_services[NUM_SERVICES].protocol_id=NUM_SERVICES;
NUM_SERVICES++;
- sprintf(buf, "%s::path", servicename);
+ snprintf(buf, sizeof(buf), "%s::path", servicename);
cSetLocalPref(buf, "Empty Module");
return(NUM_SERVICES-1);
}
Index: speech.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/speech.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- speech.c 26 Jan 2003 11:44:45 -0000 1.4
+++ speech.c 25 Mar 2003 22:06:13 -0000 1.5
@@ -45,7 +45,7 @@
strcpy(xbuff, message);
strip_html(xbuff);
// todo: convert "LOL" to "ha ha ha"?
- sprintf(mbuff, "%s says: ", remote->handle);
+ snprintf(mbuff, sizeof(mbuff), "%s says: ", remote->handle);
say_strings(mbuff,
(voice == NULL ? DEFAULTMESSAGEBODYVOICE : voice),
xbuff);
Index: status.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/status.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- status.c 25 Mar 2003 15:10:50 -0000 1.78
+++ status.c 25 Mar 2003 22:06:13 -0000 1.79
@@ -196,7 +196,7 @@
grouplist * g = (grouplist *) d;
char buff [1024];
- sprintf (buff, _("Do you really want to delete group \"%s\"?"),
g->name);
+ snprintf(buff, sizeof(buff), _("Do you really want to delete
group \"%s\"?"), g->name);
do_dialog (buff, _("Delete Group"), remove_group_callback, d);
}
}
@@ -220,7 +220,7 @@
struct contact * c = (struct contact *) d;
char buff [1024];
- sprintf (buff, _("Do you really want to delete contact
\"%s\"?"), c->nick);
+ snprintf(buff, sizeof(buff), _("Do you really want to delete
contact \"%s\"?"), c->nick);
do_dialog (buff, _("Delete Contact"), remove_contact_callback,
d);
}
}
@@ -242,7 +242,7 @@
struct account * a = (struct account *) d;
char buff [1024];
- sprintf (buff, _("Do you really want to delete account
\"%s\"?"), a->handle);
+ snprintf(buff, sizeof(buff), _("Do you really want to delete
account \"%s\"?"), a->handle);
do_dialog (buff, _("Delete Account"), remove_account_callback,
d);
}
}
Index: trigger.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/trigger.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- trigger.c 29 Jan 2003 19:19:23 -0000 1.11
+++ trigger.c 25 Mar 2003 22:06:13 -0000 1.12
@@ -111,8 +111,9 @@
else
{
strncat(param_string, basestr, (size_t)(substr-basestr));
- strcat(param_string, ((trigger_type == USER_ONLINE) ?
- _("online") : _("offline")));
+ strncat(param_string, ((trigger_type == USER_ONLINE) ?
+ _("online") : _("offline")),
+
(size_t)(sizeof(param_string)-strlen(param_string)));
basestr = substr + 2;
}
if((strlen(param_string) + strlen(basestr) + 8) >
@@ -125,7 +126,7 @@
}
}
/* copy remainder (or all if no subst done) */
- strcat(param_string, basestr);
+ strncat(param_string, basestr,
(size_t)(sizeof(param_string)-strlen(param_string)));
if(con->trigger.action == PLAY_SOUND)
{
Index: util.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- util.c 24 Mar 2003 10:31:35 -0000 1.60
+++ util.c 25 Mar 2003 22:06:13 -0000 1.61
@@ -386,6 +386,7 @@
g_string_prepend(g2, "mailto:");
eb_debug(DBG_HTML, "TOKEN: %s\n", token->str);
+ /* g_string_sprintf is safe */
g_string_sprintf(token, "<A HREF=\"%s\">%s</A>", g2->str, g->str);
g_string_free(g,TRUE);
@@ -1388,14 +1389,14 @@
char data[20];
fscanf(f, "%d", &ourpid);
fclose(f);
- sprintf(data, "/proc/%d", ourpid);
+ snprintf(data, sizeof(data), "/proc/%d", ourpid);
if(stat(data, &sbuff) != 0) {
fprintf(stderr, _("deleting stale lock
file\n"));
unlink(fname); /*delete lock file and try again
:) */
return create_lock_file(fname);
} else {
FILE * fd = NULL;
- sprintf(data, "%s/cmdline", data);
+ snprintf(data, sizeof(data), "%s/cmdline",
data);
fd = fopen(data, "r");
if(fd==NULL)
perror("fopen");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/src chat_window.c,1.64,1.65 crash.c,1.13,1.14 input_list.c,1.9,1.10 log_window.c,1.21,1.22 mem_util.c,1.2,1.3 plugin.c,1.11,1.12 service.c,1.15,1.16 speech.c,1.4,1.5 status.c,1.78,1.79 trigger.c,1.11,1.12 util.c,1.60,1.61,
Colin Leroy <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.427,1.428 configure.in,1.424,1.425
- Next by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.428,1.429 configure.in,1.425,1.426
- Previous by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.427,1.428 configure.in,1.424,1.425
- Next by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.428,1.429 configure.in,1.425,1.426
- Index(es):