summaryrefslogtreecommitdiffstats
path: root/recipes-containers/docker/files/CVE-2024-36620.patch
blob: 03628fb36e5b7677ced571dded8d437ddef55cb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From ab570ab3d62038b3d26f96a9bb585d0b6095b9b4 Mon Sep 17 00:00:00 2001
From: Christopher Petito <47751006+krissetto@users.noreply.github.com>
Date: Fri, 19 Apr 2024 10:44:30 +0000
Subject: [PATCH] nil dereference fix on image history Created value

Issue was caused by the changes here https://github.com/moby/moby/pull/45504
First released in v25.0.0-beta.1

CVE: CVE-2024-36620

Upstream-Status: Backport [https://github.com/moby/moby/commit/ab570ab3d62038b3d26f96a9bb585d0b6095b9b4]

Signed-off-by: Praveen Kumar <praveen.kumar@windriver.com>
---
 daemon/images/image_history.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/daemon/images/image_history.go b/daemon/images/image_history.go
index dcf7a906aa..e5adda8639 100644
--- a/daemon/images/image_history.go
+++ b/daemon/images/image_history.go
@@ -41,10 +41,14 @@ func (i *ImageService) ImageHistory(ctx context.Context, name string) ([]*image.
			layer.ReleaseAndLog(i.layerStore, l)
			layerCounter++
		}
+		var created int64
+		if h.Created != nil {
+			created = h.Created.Unix()
+		}

		history = append([]*image.HistoryResponseItem{{
			ID:        "<missing>",
-			Created:   h.Created.Unix(),
+			Created:   created,
			CreatedBy: h.CreatedBy,
			Comment:   h.Comment,
			Size:      layerSize,
--
2.40.0