[asterisk-commits] phsultan: branch 1.4 r81743 - in /branches/1.4: channels/ include/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 6 11:56:29 CDT 2007


Author: phsultan
Date: Thu Sep  6 11:56:29 2007
New Revision: 81743

URL: http://svn.digium.com/view/asterisk?view=rev&rev=81743
Log:
Various string length fixes. Removed an unused variable in aji_client structure (context)

Modified:
    branches/1.4/channels/chan_gtalk.c
    branches/1.4/include/asterisk/jabber.h

Modified: branches/1.4/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_gtalk.c?view=diff&rev=81743&r1=81742&r2=81743
==============================================================================
--- branches/1.4/channels/chan_gtalk.c (original)
+++ branches/1.4/channels/chan_gtalk.c Thu Sep  6 11:56:29 2007
@@ -111,8 +111,8 @@
 	time_t laststun;
 	struct gtalk *parent;	         /*!< Parent client */
 	char sid[100];
-	char us[100];
-	char them[100];
+	char us[AJI_MAX_JIDLEN];
+	char them[AJI_MAX_JIDLEN];
 	char ring[10];                   /*!< Message ID of ring */
 	iksrule *ringrule;               /*!< Rule for matching RING request */
 	int initiator;                   /*!< If we're the initiator */
@@ -154,8 +154,8 @@
 	struct gtalk_pvt *p;
 	struct ast_codec_pref prefs;
 	int amaflags;			/*!< AMA Flags */
-	char user[100];
-	char context[100];
+	char user[AJI_MAX_JIDLEN];
+	char context[AST_MAX_CONTEXT];
 	char accountcode[AST_MAX_ACCOUNT_CODE];	/*!< Account code */
 	int capability;
 	ast_group_t callgroup;	/*!< Call group */
@@ -1567,7 +1567,7 @@
 	struct gtalk_pvt *p;
 	struct ast_channel *chan;
 	int numchans = 0;
-	char them[100];
+	char them[AJI_MAX_JIDLEN];
 	char *jid = NULL;
 	char *resource = NULL;
 
@@ -1758,7 +1758,7 @@
 {
 	char *cat = NULL;
 	struct ast_config *cfg = NULL;
-	char context[100];
+	char context[AST_MAX_CONTEXT];
 	int allowguest = 1;
 	struct ast_variable *var;
 	struct gtalk *member;

Modified: branches/1.4/include/asterisk/jabber.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/jabber.h?view=diff&rev=81743&r1=81742&r2=81743
==============================================================================
--- branches/1.4/include/asterisk/jabber.h (original)
+++ branches/1.4/include/asterisk/jabber.h Thu Sep  6 11:56:29 2007
@@ -22,6 +22,19 @@
 #include <iksemel.h>
 #include "asterisk/astobj.h"
 #include "asterisk/linkedlists.h"
+
+/* 
+ * As per RFC 3920 - section 3.1, the maximum length for a full Jabber ID 
+ * is 3071 bytes.
+ * The ABNF syntax for jid :
+ * jid = [node "@" ] domain [ "/" resource ]
+ * Each allowable portion of a JID (node identifier, domain identifier,
+ * and resource identifier) MUST NOT be more than 1023 bytes in length,
+ * resulting in a maximum total size (including the '@' and '/' separators) 
+ * of 3071 bytes.
+ */
+#define AJI_MAX_JIDLEN 3071
+#define AJI_MAX_RESJIDLEN 1023
 
 enum aji_state {
 	AJI_DISCONNECTING,
@@ -56,7 +69,7 @@
 
 struct aji_resource {
 	int status;
-	char resource[80];
+	char resource[AJI_MAX_RESJIDLEN];
 	char *description;
 	struct aji_version *cap;
 	int priority;
@@ -72,7 +85,7 @@
 };
 
 struct aji_buddy {
-	ASTOBJ_COMPONENTS(struct aji_buddy);
+	ASTOBJ_COMPONENTS_FULL(struct aji_buddy, AJI_MAX_JIDLEN, 1);
 	struct aji_resource *resources;
 	unsigned int flags;
 };
@@ -88,9 +101,8 @@
 struct aji_client {
 	ASTOBJ_COMPONENTS(struct aji_client);
 	char password[160];
-	char user[160];
-	char serverhost[160];
-	char context[100];
+	char user[AJI_MAX_JIDLEN];
+	char serverhost[AJI_MAX_RESJIDLEN];
 	char statusmessage[256];
 	char sid[10]; /* Session ID */
 	char mid[6]; /* Message ID */




More information about the asterisk-commits mailing list