[829] in BarnOwl Developers

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

[D-O-H] r821 - trunk/owl

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:10:09 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: nelhage@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Thu, 10 Jan 2008 01:29:00 -0500 (EST)

Author: nelhage
Date: 2008-01-10 01:28:59 -0500 (Thu, 10 Jan 2008)
New Revision: 821

Modified:
   trunk/owl/zephyr.c
Log:
sprintf -> snprintf


Modified: trunk/owl/zephyr.c
===================================================================
--- trunk/owl/zephyr.c	2008-01-10 06:16:33 UTC (rev 820)
+++ trunk/owl/zephyr.c	2008-01-10 06:28:59 UTC (rev 821)
@@ -562,24 +562,27 @@
       owl_function_makemsg("Message sent to -c %s -i %s\n", retnotice->z_class, retnotice->z_class_inst);
     }
   } else if (!strcmp(retnotice->z_message, ZSRVACK_NOTSENT)) {
+    #define BUFFLEN 1024
     if (retnotice->z_recipient == NULL
         || *retnotice->z_recipient == NULL
         || *retnotice->z_recipient == '@') {
-      char buff[1024];
+      char buff[BUFFLEN];
       owl_function_error("No one subscribed to class %s", retnotice->z_class);
-      sprintf(buff, "Could not send message to class %s: no one subscribed.\n", retnotice->z_class);
+      snprintf(buff, BUFFLEN, "Could not send message to class %s: no one subscribed.\n", retnotice->z_class);
       owl_function_adminmsg("", buff);
     } else {
-      char buff[1024];
+      char buff[BUFFLEN];
       tmp = short_zuser(retnotice->z_recipient);
       owl_function_error("%s: Not logged in or subscribing.", tmp);
-      sprintf(buff, "Could not send message to %s: not logged in or subscribing to", tmp);
+      snprintf(buff, BUFFLEN, "Could not send message to %s: not logged in or subscribing to", tmp);
       if(strcmp(retnotice->z_class, "message")) {
-        sprintf(buff, "%s class %s, instance %s.\n", buff,
-                retnotice->z_class,
-                retnotice->z_class_inst);
+        snprintf(buff, BUFFLEN,
+                 "%s class %s, instance %s.\n", buff,
+                 retnotice->z_class,
+                 retnotice->z_class_inst);
       } else {
-        sprintf(buff, "%s messages.\n", buff);
+        snprintf(buff, BUFFLEN,
+                 "%s messages.\n", buff);
       }
       owl_function_adminmsg("", buff);
       owl_log_outgoing_zephyr_error(tmp, buff);


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