~ben-links/apache-mod-digest/bensbranch

« back to all changes in this revision

Viewing changes to src/mod_digest.c

  • Committer: Ben Laurie
  • Date: 2008-05-12 09:54:19 UTC
  • Revision ID: ben@links.org-20080512095419-gmm6sja3oe02yywj
Check lengths more carefully.

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
            int i;
126
126
 
127
127
            EVP_DigestFinal_ex(&ctx->md_ctx, md, &md_length);
 
128
            // Note that we've already overflowed by the time this
 
129
            // assert can trigger, but there's no way to fix that.
128
130
            ap_assert(md_length <= sizeof md);
129
131
            EVP_MD_CTX_cleanup(&ctx->md_ctx);
130
132
 
 
133
            ap_assert(md_length*2+1 <= sizeof ctx->txt_md);
131
134
            for (i = 0; i < md_length; i++)
132
135
               snprintf(&(ctx->txt_md[i*2]), 3, "%02x", (int) md[i]);
133
136
            apr_table_setn(f->r->notes, "DIGEST", ctx->txt_md);