Skip to content
Heist/ feed
Back to feed
High

Security advisory

Type: advisorySources: OSVCVE: CVE-2021-32765

Hiredis is a minimalistic C client library for the Redis database. In affected versions Hiredis is vulnurable to integer overflow if provided maliciously crafted or corrupted `RESP` `mult-bulk` protocol data. When parsing `multi-bulk` (array-like) replies, hiredis fails to check if `count * sizeof(redisReply*)` can be represented in `SIZE_MAX`. If it can not, and the `calloc()` call doesn't itself make this check, it would result in a short allocation and subsequent buffer overflow. Users of hiredis who are unable to update may set the [maxelements](https://github.com/redis/hiredis#reader-max-array-elements) context option to a value small enough that no overflow is possible.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2021-32765
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 12:43 UTC · Revision 1

Source evidence

CVE-2021-32765

core-osv · Original source

Published 4 Oct 2021, 21:15 UTC

Hiredis is a minimalistic C client library for the Redis database. In affected versions Hiredis is vulnurable to integer overflow if provided maliciously crafted or corrupted `RESP` `mult-bulk` protocol data. When parsing `multi-bulk` (array-like) replies, hiredis fails to check if `count * sizeof(redisReply*)` can be represented in `SIZE_MAX`. If it can not, and the `calloc()` call doesn't itself make this check, it would result in a short allocation and subsequent buffer overflow. Users of hiredis who are unable to update may set the [maxelements](https://github.com/redis/hiredis#reader-max-array-elements) context option to a value small enough that no overflow is possible.

osv:CVE-2021-32765
Complete source record
{
  "id": "4a29e23f95455566b896d93b21ba7ed80513d9144b1ce03d82e25038e866f2aa",
  "url": "https://osv.dev/vulnerability/CVE-2021-32765",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "CVE-2021-32765",
    "summary": "Hiredis is a minimalistic C client library for the Redis database. In affected versions Hiredis is vulnurable to integer overflow if provided maliciously crafted or corrupted `RESP` `mult-bulk` protocol data. When parsing `multi-bulk` (array-like) replies, hiredis fails to check if `count * sizeof(redisReply*)` can be represented in `SIZE_MAX`. If it can not, and the `calloc()` call doesn't itself make this check, it would result in a short allocation and subsequent buffer overflow. Users of hiredis who are unable to update may set the [maxelements](https://github.com/redis/hiredis#reader-max-array-elements) context option to a value small enough that no overflow is possible.",
    "evidence": "osv:CVE-2021-32765",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2021-32765",
      "aliases": [
        "CVE-2021-32765",
        "GHSA-hfm9-39pp-55p2"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/redis/hiredis",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "8d1bfac4640fe90cd6f800d09b7f53e886569b98"
                },
                {
                  "fixed": "76a7b10005c70babee357a7d0f2becf28ec7ed1e"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:redis:hiredis:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "1.0.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "76a7b10005c70babee357a7d0f2becf28ec7ed1e"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v1.0.0",
            "v1.0.0-rc1",
            "v0.14.0",
            "v0.13.3",
            "v0.13.2",
            "v0.13.1",
            "v0.13.0",
            "v0.12.1",
            "v0.12.0",
            "v0.11.0",
            "v0.10.1",
            "v0.10.0",
            "v0.9.2",
            "v0.9.1",
            "v0.9.0",
            "v0.0.1"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-32765.json",
            "vanir_signatures": [
              {
                "id": "CVE-2021-32765-28fc1741",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "2960801188689279389740907912361228292",
                    "103680156091366763705168315892522468615",
                    "313519843436751110082004899014515685551"
                  ]
                },
                "source": "https://github.com/redis/hiredis/commit/76a7b10005c70babee357a7d0f2becf28ec7ed1e",
                "target": {
                  "file": "test.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CVE-2021-32765-39e6d2f9",
                "digest": {
                  "length": 581,
                  "function_hash": "179161735348210698687051920573265359593"
                },
                "source": "https://github.com/redis/hiredis/commit/76a7b10005c70babee357a7d0f2becf28ec7ed1e",
                "target": {
                  "file": "hiredis.c",
                  "function": "createArrayObject"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              },
              {
                "id": "CVE-2021-32765-40ddc6e5",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "311195162694762926584360255253075821286",
                    "34398200280396169294640070927249867179",
                    "76188935927609120202871962455023382498",
                    "186027357458498207079532665570846242970"
                  ]
                },
                "source": "https://github.com/redis/hiredis/commit/76a7b10005c70babee357a7d0f2becf28ec7ed1e",
                "target": {
                  "file": "hiredis.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CVE-2021-32765-b253503e",
                "digest": {
                  "length": 6546,
                  "function_hash": "160136926384499477379751229509923238067"
                },
                "source": "https://github.com/redis/hiredis/commit/76a7b10005c70babee357a7d0f2becf28ec7ed1e",
                "target": {
                  "file": "test.c",
                  "function": "test_reply_reader"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              }
            ],
            "vanir_signatures_modified": "2026-10-20T14:23:23Z"
          }
        }
      ],
      "modified": "2026-10-20T14:23:23.774285648Z",
      "provider": "osv",
      "references": [
        "https://github.com/redis/hiredis/security/advisories/GHSA-hfm9-39pp-55p2",
        "https://lists.debian.org/debian-lts-announce/2021/10/msg00007.html",
        "https://security.gentoo.org/glsa/202210-32",
        "https://security.netapp.com/advisory/ntap-20211104-0003/",
        "https://wiki.sei.cmu.edu/confluence/display/c/MEM07-C.+Ensure+that+the+arguments+to+calloc%28%29%2C+when+multiplied%2C+do+not+wrap",
        "https://github.com/redis/hiredis/commit/76a7b10005c70babee357a7d0f2becf28ec7ed1e"
      ],
      "provider_metadata": {
        "unresolved_ranges": [
          {
            "cpes": [
              "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*"
            ],
            "vendor_product": "debian:debian_linux",
            "extracted_events": [
              {
                "range": [
                  {
                    "introduced": "9.0"
                  },
                  {
                    "last_affected": "9.0"
                  }
                ],
                "source": "CPE_STRING"
              }
            ]
          }
        ]
      }
    },
    "related_cves": [
      {
        "value": "CVE-2021-32765",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 388851,
  "published_at": "2021-10-04T21:15:12.527+00:00"
}