Changeset 6201646


Ignore:
Timestamp:
Dec 28, 2007, 5:21:57 PM (16 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
7b1d048
Parents:
5376a95
Message:
Fixing bug encountered when last field was not null-terminated.
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • message.c

    r5376a95 r6201646  
    7979    owl_list_append_element(&(m->attributes), pair);
    8080  }
    81   owl_pair_set_value(pair, owl_validate_or_convert(attrvalue, -1));
     81  owl_pair_set_value(pair, owl_validate_or_convert(attrvalue));
    8282}
    8383
  • util.c

    r5376a95 r6201646  
    801801 * for formatting.
    802802 */
    803 char * owl_validate_or_convert(char *in, int len)
    804 {
    805   if (g_utf8_validate(in, len , NULL)) {
     803char * owl_validate_or_convert(char *in)
     804{
     805  if (g_utf8_validate(in, -1, NULL)) {
    806806    return owl_strip_format_chars(in);
    807807  }
    808808  else {
    809     return g_convert(in, len,
     809    return g_convert(in, -1,
    810810                     "UTF-8", "ISO-8859-1",
    811811                     NULL, NULL, NULL);
  • zephyr.c

    r5376a95 r6201646  
    369369      if (count == j) {
    370370        /* just found the end of the field we're looking for */
    371         return(owl_validate_or_convert(n->z_message + save, -1));
     371        return(owl_validate_or_convert(n->z_message + save));
    372372      } else {
    373373        save = i + 1;
     
    377377  /* catch the last field, which might not be null terminated */
    378378  if (count == j - 1) {
    379     return owl_validate_or_convert(n->z_message + save, n->z_message_len - save);
     379    char *tmp, *out;
     380    tmp = owl_malloc(n->z_message_len-save+5);
     381    memcpy(tmp, n->z_message+save, n->z_message_len-save);
     382    tmp[n->z_message_len-save]='\0';
     383    out = owl_validate_or_convert(tmp);
     384    owl_free(tmp);
     385    return out;
    380386  }
    381387
Note: See TracChangeset for help on using the changeset viewer.