Changeset 1c6c4d3 for zephyr.c


Ignore:
Timestamp:
Jun 30, 2002, 4:58:09 PM (19 years ago)
Author:
Erik Nygren <nygren@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
507d5aa
Parents:
262422c
Message:
	Added owl_sprintf which returns the formatted string, or NULL.
	        The caller must free this string.
		This will allocate enough memory and thus
		avoid potential some buffer overrun situations.
	Started fixing some potential buffer overrun situations.
	Simple implementation of 'zwrite -m' (doesn't yet log an outgoing
	        message as having been sent.)
	The "Not logged in or subscribing to messages" error
	        now includes the name of the recipient.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zephyr.c

    r1aee7d9 r1c6c4d3  
    111111        subs[count].zsub_classinst=owl_strdup(buffer);
    112112      } else {
    113         subs[count].zsub_classinst=owl_malloc(1024);
    114         sprintf(subs[count].zsub_classinst, "%s@%s", buffer, ZGetRealm());
     113        subs[count].zsub_classinst=owl_sprintf("%s@%s", buffer, ZGetRealm());
    115114      }
    116115
     
    346345
    347346void owl_zephyr_handle_ack(ZNotice_t *retnotice) {
    348   char buff[LINE];
    349347  char *tmp;
    350348 
     
    362360               !strcasecmp(retnotice->z_class_inst, "personal")) {
    363361      tmp=pretty_sender(retnotice->z_recipient);
    364       sprintf(buff, "Message sent to %s.", tmp);
     362      owl_function_makemsg("Message sent to %s.", tmp);
    365363      free(tmp);
    366364    } else {
    367       sprintf(buff, "Message sent to -c %s -i %s\n", retnotice->z_class, retnotice->z_class_inst);
    368     }
    369     owl_function_makemsg(buff);
     365      owl_function_makemsg("Message sent to -c %s -i %s\n", retnotice->z_class, retnotice->z_class_inst);
     366    }
    370367  } else if (!strcmp(retnotice->z_message, ZSRVACK_NOTSENT)) {
    371368    if (strcasecmp(retnotice->z_class, "message")) {
    372       sprintf(buff, "Not logged in or not subscribing to class %s, instance %s",
     369      owl_function_makemsg("Not logged in or not subscribing to class %s, instance %s",
    373370              retnotice->z_class, retnotice->z_class_inst);
    374       owl_function_makemsg(buff);
    375371    } else {
    376       owl_function_makemsg("Not logged in or subscribing to messages.");
    377     }
    378   } else {
    379     char buff[1024];
    380     sprintf(buff, "Internal error on ack (%s)", retnotice->z_message);
    381     owl_function_makemsg(buff);
     372      tmp = pretty_sender(retnotice->z_recipient);
     373      owl_function_makemsg("%s: Not logged in or subscribing to messages.",
     374                           tmp);
     375      owl_free(tmp);
     376    }
     377  } else {
     378    owl_function_makemsg("Internal error on ack (%s)", retnotice->z_message);
    382379  }
    383380}
     
    412409
    413410  /* display the message as an admin message in the receive window */
    414   tmpbuff=owl_malloc(strlen(owl_global_get_zaway_msg(&g))+LINE);
    415   sprintf(tmpbuff, "Message sent to %s", owl_message_get_sender(m));
     411  tmpbuff = owl_sprintf("Message sent to %s", owl_message_get_sender(m));
    416412  owl_function_adminmsg(tmpbuff, owl_global_get_zaway_msg(&g));
    417413  owl_free(tmpbuff);
Note: See TracChangeset for help on using the changeset viewer.