[26803] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r25764 - in trunk/athena/bin/discuss: client debian

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Thu Sep 13 17:05:48 2012

Date: Thu, 13 Sep 2012 17:05:41 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201209132105.q8DL5flS026332@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2012-09-13 17:05:41 -0400 (Thu, 13 Sep 2012)
New Revision: 25764

Modified:
   trunk/athena/bin/discuss/client/addmtg.c
   trunk/athena/bin/discuss/debian/changelog
Log:
In discuss:
  * Fix buffer overflow when re-adding meeting (Trac: #973)


Modified: trunk/athena/bin/discuss/client/addmtg.c
===================================================================
--- trunk/athena/bin/discuss/client/addmtg.c	2012-09-13 18:37:00 UTC (rev 25763)
+++ trunk/athena/bin/discuss/client/addmtg.c	2012-09-13 21:05:41 UTC (rev 25764)
@@ -368,7 +368,8 @@
 	int *code;
 {
 	name_blk *nbp,temp_nb;
-	char question[100];
+	const char *prompt = "Meeting %s already exists.\nDo you wish to delete the old one and add the new one? ";
+	char *question = NULL;
 	int j;
 
 	/* see if we're already attending... */
@@ -382,14 +383,20 @@
 	for (j = 0; new_nbp->aliases[j] != NULL; j++) {
 	     dsc_get_mtg (user_id, new_nbp->aliases[j], &temp_nb, code);
 	     if (*code == 0) {				/* already exists */
-		  sprintf (question, "Meeting %s already exists.\nDo you wish to delete the old one and add the new one? ",new_nbp -> aliases[j]);
+	          question = malloc(strlen(prompt) - 2 + strlen(new_nbp -> aliases[j]) + 1);
+		       if (! question) {
+			    fprintf(stderr, "Couldn't malloc.  Too bad...");
+			    return;
+		       }
+		  sprintf (question, prompt, new_nbp -> aliases[j]);
 		  if (!command_query (question)) {
 		       printf ("Meeting not added.\n");
 		       dsc_destroy_name_blk (&temp_nb);
 		       *code = DISC_ACTION_NOT_PERFORMED;
+		       free(question);
 		       return;
 		  }
-
+		  free(question);
 		  del_the_mtg (&temp_nb, code);
 		  if (*code != 0) {
 		       dsc_destroy_name_blk (&temp_nb);

Modified: trunk/athena/bin/discuss/debian/changelog
===================================================================
--- trunk/athena/bin/discuss/debian/changelog	2012-09-13 18:37:00 UTC (rev 25763)
+++ trunk/athena/bin/discuss/debian/changelog	2012-09-13 21:05:41 UTC (rev 25764)
@@ -5,8 +5,9 @@
   * Cleanup man pages so they don't generate errors
   * Add missing man pages to satisfy Lintian
   * Comply with Lintian's feelings on grammar
+  * Fix buffer overflow when re-adding meeting (Trac: #973)
 
- -- Jonathan Reed <jdreed@mit.edu>  Fri, 07 Sep 2012 15:53:02 -0400
+ -- Jonathan Reed <jdreed@mit.edu>  Thu, 13 Sep 2012 17:02:56 -0400
 
 debathena-discuss (10.0.15-0debathena1) unstable; urgency=low
 


home help back first fref pref prev next nref lref last post