blob: 0d8f427a9a7df75dc17084546990e808ebe2e56c (
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
|
From 2db6add74c621344e902ce28b5e6764f6ef55b8e Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Mon, 18 Dec 2023 16:07:57 +0800
Subject: [PATCH 63/64] code improve for oci_rmi
Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
src/daemon/modules/image/oci/oci_image.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/daemon/modules/image/oci/oci_image.c b/src/daemon/modules/image/oci/oci_image.c
index 471510e7..9cf2cd4f 100644
--- a/src/daemon/modules/image/oci/oci_image.c
+++ b/src/daemon/modules/image/oci/oci_image.c
@@ -542,6 +542,17 @@ int oci_rmi(const im_rmi_request *request)
goto out;
}
+ for (i = 0; i < image_names_len; i++) {
+ if (strcmp(real_image_name, image_names[i]) == 0) {
+ break;
+ }
+ }
+ if (i == image_names_len) {
+ ERROR("Invalid real_image_name");
+ ret = -1;
+ goto out;
+ }
+
reduced_image_names = (char **)util_smart_calloc_s(sizeof(char *), image_names_len - 1);
if (reduced_image_names == NULL) {
ERROR("Out of memory");
--
2.42.0
|