]> granicus.if.org Git - libevent/commit
Convert evbuffer_strspn() (internal helper) to use size_t
authorAzat Khuzhin <a3at.mail@gmail.com>
Sun, 28 Oct 2018 13:46:24 +0000 (16:46 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Sun, 28 Oct 2018 13:50:36 +0000 (16:50 +0300)
commit931ec2370228e40309af51b86e10fa364a37a20e
treea07ae64421664be4e01df9d348c0d8bbbf6679b7
parentf83ac92da9fff789135d1e5b9050653cf7fdb517
Convert evbuffer_strspn() (internal helper) to use size_t

As pointed by @yankeehacker in #590:
  Signed to Unsigned Conversion Error - buffer.c:1623

  Description: This assignment creates a type mismatch by populating an
  unsigned variable with a signed value. The signed integer will be
  implicitly cast to an unsigned integer, converting negative values into
  positive ones. If an attacker can control the signed value, it may be
  possible to trigger a buffer overflow if the value specifies the length
  of a memory write.

  Remediation: Do not rely on implicit casts between signed and unsigned
  values because the result can take on an unexpected value and violate
  weak assumptions made elsewhere in the program.

Fixes: #590
buffer.c