Changeset 54e1fe4 for message.c


Ignore:
Timestamp:
Mar 1, 2010, 8:33:48 PM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
release-1.5
Children:
8fff19a
Parents:
b381b55
git-author:
Anders Kaseorg <andersk@mit.edu> (02/07/10 22:55:21)
git-committer:
Nelson Elhage <nelhage@mit.edu> (03/01/10 20:33:48)
Message:
zcrypt: Change zcrypt functions to allocate their output buffer.

The logic to determine the right buffer size is complicated and does
not belong in callers.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Nelson Elhage <nelhage@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • message.c

    rb381b55 r54e1fe4  
    841841  /* if zcrypt is enabled try to decrypt the message */
    842842  if (owl_global_is_zcrypt(&g) && !strcasecmp(n->z_opcode, "crypt")) {
    843     char *out;
    844     int ret;
    845 
    846     out=owl_malloc(strlen(owl_message_get_body(m))*16+20);
    847     ret=owl_zcrypt_decrypt(out, owl_message_get_body(m), owl_message_get_class(m), owl_message_get_instance(m));
    848     if (ret == 0)
     843    char *out = owl_zcrypt_decrypt(owl_message_get_body(m), owl_message_get_class(m), owl_message_get_instance(m));
     844    if (out) {
    849845      owl_message_set_body(m, out);
    850     owl_free(out);
     846      owl_free(out);
     847    }
    851848  }
    852849#endif 
Note: See TracChangeset for help on using the changeset viewer.