Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Call  at imap-utf7.c:92

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

imap_utf8_to_utf7

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-imap/imap-utf7.c)expand/collapse
Show more  
 58  int imap_utf8_to_utf7(const char *src, string_t *dest)
 59  {
 60          const char *p;
 61          unichar_t chr;
 62          uint8_t *utf16, *u;
 63          uint16_t u16;
 64   
 65          for (p = src; *p != '\0'; p++) {
 66                  if (*p == '&' || (unsigned char)*p >= 0x80)
 67                          break;
 68          }
 69          if (*p == '\0') {
 70                  /* no ASCII characters that need to be encoded */
 71                  str_append(dest, src);
 72                  return 0;
 73          }
 74   
 75          /* at least one encoded character */
 76          str_append_n(dest, src, p-src);
 77          utf16 = t_malloc(strlen(p)*2);
 78          while (*p != '\0') {
 79                  if (*p == '&') {
 80                          str_append(dest, "&-");
 81                          p++;
 82                          continue;
 83                  }
 84                  if ((unsigned char)*p < 0x80) {
 85                          str_append_c(dest, *p);
 86                          p++;
 87                          continue;
 88                  }
 89   
 90                  u = utf16;
 91                  while ((unsigned char)*p >= 0x80) {
 92                          if (uni_utf8_get_char(p, &chr) <= 0)
 93                                  return -1;
 94                          /* @UNSAFE */
 95                          if (chr < UTF16_SURROGATE_BASE) {
 96                                  *u++ = chr >> 8;
 97                                  *u++ = chr & 0xff;
 98                          } else {
 99                                  u16 = UTF16_SURROGATE_HIGH(chr);
 100                                  *u++ = u16 >> 8;
 101                                  *u++ = u16 & 0xff;
 102                                  u16 = UTF16_SURROGATE_LOW(chr);
 103                                  *u++ = u16 >> 8;
 104                                  *u++ = u16 & 0xff;
 105                          }
 106                          p += uni_utf8_char_bytes(*p);
 107                  }
 108                  mbase64_encode(dest, utf16, u-utf16);
 109          }
 110          return 0;
 111  }
Show more  




Change Warning 7178.24617 : Unreachable Call

Priority:
State:
Finding:
Owner:
Note: