Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • L libotr
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 50
    • Issues 50
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Libraries
  • libotr
  • Issues
  • #47

Closed
Open
Created Apr 01, 2016 by David Goulet@dgouletOwner

otrl_base64_encode handling len issue

otrl_base64_encode returns the number of bytes actually used, which may be less than ((datalen+2)/3)*4.

otrl_base64_otr_encode ignores what otrl_base64_encode returns, say n, and may fail to initialize bytes

   base64buf[5 + n],
   base64buf[5 + n + 1],
   ...,
   base64buf[5 + n + (((datalen+2)/3)*4 - n - 1)].

The first byte it initializes after the (potential) gap is

base64buf[5 + (((datalen+2)/3)*4)],

which it sets to '.'.

otrl_base64_otr_encode should instead do something like:

   size_t base64len_max, base64len;

   base64len_max = ((buflen + 2) / 3) * 4;
   ...
   base64len = otrl_base64_otr_encode(base64buf+5, buf, buflen);
   assert(base64len <= base64len_max);

This has been reported by Riastradh on #otr

(from redmine: created on 2014-07-30)

Edited Mar 22, 2021 by David Goulet
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking