Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #19066

Closed (moved)
(moved)
Open
Created May 16, 2016 by David Goulet@dgoulet🆘

Wrong length used in networkstatus_parse_detached_signatures

While fixing #14013 (moved), nikkolasg realized thatif we did in fact use != DIGEST256_LEN it caused a failure in the test:

    // XXX Should it not be always DIGEST256_LEN ? Running the tests with
    // the condition ` != DIGEST256_LEN` fails.
    if (base16_decode(digests->d[alg], DIGEST256_LEN,
                      hexdigest, strlen(hexdigest)) < 0) {

Turns out that alg here is actually sha1 thus of size DIGEST_LEN. The base16 decode is safe with a larger length but this check (just above in the code) could resolved in unwanted behavior:

    if (!tor_mem_is_zero(digests->d[alg], DIGEST256_LEN)) {

tor_mem_is_zero does make sure that the full length is zeroes thus here looking for 12 extra bytes out of bound to be 0... (DIGEST_LEN vs DIGEST256_LEN). The length we used should be set according to the algorithm in alg

Patch coming soon.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking