removed all references to sprintf from several files (not all files yet)
[citadel.git] / citadel / imap_misc.c
index 75e4b0d33138c072c9e9d298e366716e10ef53ee..b5b42d60c6a9d0f624a8dd628dea3f3a463e7b58 100644 (file)
@@ -141,6 +141,7 @@ void imap_print_express_messages(void) {
        struct ExpressMessage *ptr, *holdptr;
        char *dumpomatic = NULL;
        int i;
+       size_t size, size2;
 
        if (CC->FirstExpressMessage == NULL) {
                return;
@@ -151,7 +152,8 @@ void imap_print_express_messages(void) {
        end_critical_section(S_SESSION_TABLE);
 
        while (ptr != NULL) {
-               dumpomatic = mallok(strlen(ptr->text) + SIZ);
+               size = strlen(ptr->text) + SIZ;
+               dumpomatic = mallok(size);
                strcpy(dumpomatic, "");
                if (ptr->flags && EM_BROADCAST)
                        strcat(dumpomatic, "Broadcast message ");
@@ -161,7 +163,9 @@ void imap_print_express_messages(void) {
                        strcat(dumpomatic, "Please logoff now, as requested ");
                else
                        strcat(dumpomatic, "Message ");
-               sprintf(&dumpomatic[strlen(dumpomatic)],
+
+               size2 = strlen(dumpomatic);
+               snprintf(&dumpomatic[size2], size - size2,
                        "from %s:\n", ptr->sender);
                if (ptr->text != NULL)
                        strcat(dumpomatic, ptr->text);