Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 861
    • Issues 861
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 43
    • Merge requests 43
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Issues
  • #1032
Closed
Open
Issue created May 05, 2015 by Bugzilla@bugzilla-migration💬Reporter

g_io_channel_read_line_backend() over-reads from the channel buffer

Submitted by Dimitar Zhekov

Link to original bug (#748969)

Description

It would be easier to explain citing the source code. From g_io_channel_read_line_backend():

  for (nextchar = use_buf->str + checked_to; nextchar < lastchar; ...)
    {
      if (channel->line_term)
        {
          if (memcmp (channel->line_term, nextchar, line_term_len) == 0)
            ...

Before comparing line_term_len bytes, there should be a check that (lastchar - nextchar) <= line_term_len.

For example, with nextchar == lastchar - 1, channel->line_term set, and line_term_len == 2, memcmp() will read 1 undefined char from the channel buffer.

This is not specific to 2.45.1, it exists since at least glib-2.28.8, and probably much earlier.

Version: 2.45.x

Assignee
Assign to
Time tracking