---
title: "ip-byte-comparison"
description: "Detect bytes.Equal comparisons between IP addresses."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ip-byte-comparison

**Default severity:** `warning`

An IPv4 address stored in `net.IP` may have either a 4-byte or 16-byte
representation. `bytes.Equal` treats those representations as different;
`net.IP.Equal` compares the address values correctly.

## Bad

```go
bytes.Equal(left, right)
```

## Good

```go
left.Equal(right)
```

Source: https://strider.gempir.com/analyzers/ip-byte-comparison/index.mdx
