[asterisk-commits] mmichelson: trunk r105864 - /trunk/main/manager.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 4 17:24:57 CST 2008


Author: mmichelson
Date: Tue Mar  4 17:24:56 2008
New Revision: 105864

URL: http://svn.digium.com/view/asterisk?view=rev&rev=105864
Log:
There are several places in manager.c where BUFSIZ is used for a buffer
which will contain nowhere near that amount of data. This makes these buffers
more reasonably sized.


Modified:
    trunk/main/manager.c

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=105864&r1=105863&r2=105864
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Tue Mar  4 17:24:56 2008
@@ -1901,7 +1901,7 @@
 	/* XXX watch out, possible deadlock - we are trying to get two channels!!! */
 	chan = ast_get_channel_by_name_locked(name);
 	if (!chan) {
-		char buf[BUFSIZ];
+		char buf[256];
 		snprintf(buf, sizeof(buf), "Channel does not exist: %s", name);
 		astman_send_error(s, m, buf);
 		return 0;
@@ -2554,12 +2554,12 @@
 	int res;
 	const char *module = astman_get_header(m, "Module");
 	const char *id = astman_get_header(m, "ActionID");
-	char idText[BUFSIZ];
+	char idText[256];
 	const char *version;
-	char filename[BUFSIZ/2];
+	char filename[PATH_MAX];
 	char *cut;
 
-	snprintf(filename, sizeof(filename), module);
+	ast_copy_string(filename, module, sizeof(filename));
 	if ((cut = strchr(filename, '.'))) {
 		*cut = '\0';
 	} else {
@@ -2698,7 +2698,7 @@
 	AST_RWLIST_UNLOCK(&actions);
 
 	if (!tmp) {
-		char buf[BUFSIZ];
+		char buf[512];
 		snprintf(buf, sizeof(buf), "Invalid/unknown command: %s. Use Action: ListCommands to show available commands.", action);
 		ast_mutex_lock(&s->__lock);
 		astman_send_error(s, m, buf);
@@ -3031,7 +3031,7 @@
 static int manager_state_cb(char *context, char *exten, int state, void *data)
 {
 	/* Notify managers of change */
-	char hint[BUFSIZ];
+	char hint[512];
 	ast_get_hint(hint, sizeof(hint), NULL, 0, NULL, context, exten);
 
 	manager_event(EVENT_FLAG_CALL, "ExtensionStatus", "Exten: %s\r\nContext: %s\r\nHint: %s\r\nStatus: %d\r\n", exten, context, hint, state);




More information about the asterisk-commits mailing list