Text   |  XML   |  ReML   |   Visible Warnings:

Buffer Overrun  at md5.c:93

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

md5_crypt_generate

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/auth/password-scheme.c)expand/collapse
Show more  
 329  md5_crypt_generate(const char *plaintext, const char *user ATTR_UNUSED,
 330                     const unsigned char **raw_password_r, size_t *size_r)
 331  {
 332          const char *password;
 333          char salt[9];
 334          unsigned int i;
 335   
 336          random_fill(salt, sizeof(salt)-1);
 337          for (i = 0; i < sizeof(salt)-1; i++)
 338                  salt[i] = salt_chars[salt[i] % (sizeof(salt_chars)-1)];
 339          salt[sizeof(salt)-1] = '\0';
 340   
 341[+]         password = password_generate_md5_crypt(plaintext, salt);
expand/collapse

password_generate_md5_crypt

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/auth/password-scheme-md5crypt.c)expand/collapse
Show more  
 49  const char *password_generate_md5_crypt(const char *pw, const char *salt)
 50  {
 51          const char *sp,*ep;
 52          unsigned char   final[MD5_RESULTLEN];
 53          int sl,pl,i,j;
 54          struct md5_context ctx,ctx1;
 55          unsigned long l;
 56          string_t *passwd;
 57          size_t pw_len = strlen(pw);
 58   
 59          /* Refine the Salt first */
 60          sp = salt;
 61   
 62          /* If it starts with the magic string, then skip that */
 63          if (strncmp(sp, magic, sizeof(magic)-1) == 0)
 64                  sp += sizeof(magic)-1;
 65   
 66          /* It stops at the first '$', max 8 chars */
 67          for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++)
 68                  continue;
 69   
 70          /* get the length of the true salt */
 71          sl = ep - sp;
 72   
 73          md5_init(&ctx);
 74   
 75          /* The password first, since that is what is most unknown */
 76          md5_update(&ctx,pw,pw_len);
 77   
 78          /* Then our magic string */
 79[+]         md5_update(&ctx,magic,sizeof(magic)-1);
 80   
 81          /* Then the raw salt */
 82[+]         md5_update(&ctx,sp,sl);
expand/collapse

md5_update

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/md5.c)expand/collapse
Show more  
 187  void md5_update(struct md5_context *ctx, const void *data, size_t size)
 188  {
 189          /* @UNSAFE */
 190          uint_fast32_t saved_lo;
 191          unsigned long used, free;
 192   
 193          saved_lo = ctx->lo;
 194          if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
 195                  ctx->hi++;
 196          ctx->hi += size >> 29;
 197   
 198          used = saved_lo & 0x3f;
 199   
 200          if (used) {
 201                  free = 64 - used;
 202   
 203                  if (size < free) {
 204                          memcpy(&ctx->buffer[used], data, size);
 205                          return;
 206                  }
 207   
 208                  memcpy(&ctx->buffer[used], data, free);
 209                  data = (const unsigned char *) data + free;
 210                  size -= free;
 211                  body(ctx, ctx->buffer, 64);
 212          }
 213   
 214          if (size >= 64) {
 215[+]                 data = body(ctx, data, size & ~(unsigned long)0x3f);
expand/collapse

body

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/md5.c)expand/collapse
Show more  
 69  static const void *body(struct md5_context *ctx, const void *data, size_t size)
 70  {
 71          const unsigned char *ptr;
 72          uint_fast32_t a, b, c, d;
 73          uint_fast32_t saved_a, saved_b, saved_c, saved_d;
 74   
 75          ptr = data;
 76   
 77          a = ctx->a;
 78          b = ctx->b;
 79          c = ctx->c;
 80          d = ctx->d;
 81   
 82          do {
 83                  saved_a = a;
 84                  saved_b = b;
 85                  saved_c = c;
 86                  saved_d = d;
 87   
 88  /* Round 1 */
 89                  STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
 90                  STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
 91                  STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
 92                  STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
 93                  STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
Show more  
Show more  
Show more  
Show more  




Change Warning 7541.24681 : Buffer Overrun

Priority:
State:
Finding:
Owner:
Note: