From 916cfa0b46ceb67b2874ae21841879e7a38de58a Mon Sep 17 00:00:00 2001 From: haozi007 Date: Thu, 16 Jun 2022 08:15:10 +0100 Subject: [PATCH] sync from upstream use vsnprintf replace vsprintf Signed-off-by: haozi007 --- 0001-parse-userns-remap-in-daemmon.json.patch | 4 +- ...schema-for-rename-subcommand-in-rest.patch | 4 +- 0003-Add-restful-interface-isula-pull.patch | 4 +- 0004-use-vsnprintf-to-replace-vsprintf.patch | 58 +++++++++++++++++++ lcr.spec | 9 ++- 5 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 0004-use-vsnprintf-to-replace-vsprintf.patch diff --git a/0001-parse-userns-remap-in-daemmon.json.patch b/0001-parse-userns-remap-in-daemmon.json.patch index e2324ad..217c7b4 100644 --- a/0001-parse-userns-remap-in-daemmon.json.patch +++ b/0001-parse-userns-remap-in-daemmon.json.patch @@ -1,7 +1,7 @@ From b81f5bb96474bbe6b3afb36dcdbe9ddc27597a53 Mon Sep 17 00:00:00 2001 From: HumbleHunger <2495970924@qq.com> Date: Thu, 5 Aug 2021 17:40:12 +0800 -Subject: [PATCH] parse userns-remap in daemmon.json +Subject: [PATCH 1/4] parse userns-remap in daemmon.json Signed-off-by: HumbleHunger <2495970924@qq.com> --- @@ -23,5 +23,5 @@ index 1134d37..54946c8 100644 "type": "int64" }, -- -2.25.1 +2.20.1 diff --git a/0002-add-rename-json-schema-for-rename-subcommand-in-rest.patch b/0002-add-rename-json-schema-for-rename-subcommand-in-rest.patch index c8ac987..3cd2841 100644 --- a/0002-add-rename-json-schema-for-rename-subcommand-in-rest.patch +++ b/0002-add-rename-json-schema-for-rename-subcommand-in-rest.patch @@ -1,7 +1,7 @@ From 91c988d01b96ba31ac495228a17644aa4aab47c9 Mon Sep 17 00:00:00 2001 From: haozi007 Date: Tue, 22 Mar 2022 07:24:11 +0000 -Subject: [PATCH 2/3] add rename json schema for rename subcommand in restful +Subject: [PATCH 2/4] add rename json schema for rename subcommand in restful mode Signed-off-by: haozi007 @@ -52,5 +52,5 @@ index 0000000..048f43d + } +} -- -2.25.1 +2.20.1 diff --git a/0003-Add-restful-interface-isula-pull.patch b/0003-Add-restful-interface-isula-pull.patch index 74f3637..79d9cde 100644 --- a/0003-Add-restful-interface-isula-pull.patch +++ b/0003-Add-restful-interface-isula-pull.patch @@ -1,7 +1,7 @@ From be04a305d16c91bb05011a9b8e88ec41f1a5f90e Mon Sep 17 00:00:00 2001 From: "yanshui.li" Date: Fri, 25 Mar 2022 03:04:59 +0000 -Subject: [PATCH 3/3] Add restful interface isula pull +Subject: [PATCH 3/4] Add restful interface isula pull --- src/json/schema/image/pull-image-request.json | 9 +++++++++ @@ -50,5 +50,5 @@ index 0000000..86c429a + } +} -- -2.25.1 +2.20.1 diff --git a/0004-use-vsnprintf-to-replace-vsprintf.patch b/0004-use-vsnprintf-to-replace-vsprintf.patch new file mode 100644 index 0000000..cc97941 --- /dev/null +++ b/0004-use-vsnprintf-to-replace-vsprintf.patch @@ -0,0 +1,58 @@ +From 00abacb3321b85dfb75039b2af7a447500f62c8b Mon Sep 17 00:00:00 2001 +From: haozi007 +Date: Thu, 16 Jun 2022 07:38:43 +0100 +Subject: [PATCH 4/4] use vsnprintf to replace vsprintf + +Signed-off-by: haozi007 +--- + src/buffer.c | 2 +- + src/error.c | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/buffer.c b/src/buffer.c +index f9955d6..39e0360 100644 +--- a/src/buffer.c ++++ b/src/buffer.c +@@ -194,7 +194,7 @@ int buffer_nappendf(Buffer *buf, size_t length, const char *format, ...) + } + + va_start(argp, format); +- status = vsprintf(tmp, format, argp); ++ status = vsnprintf(tmp, length, format, argp); + va_end(argp); + if (status < 0) { + goto error; +diff --git a/src/error.c b/src/error.c +index bed77d7..71c4856 100644 +--- a/src/error.c ++++ b/src/error.c +@@ -68,7 +68,7 @@ void lcr_set_error_message(lcr_errno_t errcode, const char *format, ...) + va_list argp; + va_start(argp, format); + +- ret = vsprintf(errbuf, format, argp); ++ ret = vsnprintf(errbuf, BUFSIZ, format, argp); + va_end(argp); + clear_error_message(&g_lcr_error); + if (ret < 0) { +@@ -89,7 +89,7 @@ void lcr_try_set_error_message(lcr_errno_t errcode, const char *format, ...) + return; + } + va_start(argp, format); +- ret = vsprintf(errbuf, format, argp); ++ ret = vsnprintf(errbuf, BUFSIZ, format, argp); + va_end(argp); + clear_error_message(&g_lcr_error); + if (ret < 0) { +@@ -109,7 +109,7 @@ void lcr_append_error_message(lcr_errno_t errcode, const char *format, ...) + va_list argp; + va_start(argp, format); + +- ret = vsprintf(errbuf, format, argp); ++ ret = vsnprintf(errbuf, BUFSIZ, format, argp); + va_end(argp); + if (ret < 0) { + g_lcr_error.errcode = LCR_ERR_FORMAT; +-- +2.20.1 + diff --git a/lcr.spec b/lcr.spec index 93287b7..9e3b3ce 100644 --- a/lcr.spec +++ b/lcr.spec @@ -1,5 +1,5 @@ %global _version 2.0.7 -%global _release 3 +%global _release 4 %global _inner_name isula_libutils Name: lcr @@ -15,6 +15,7 @@ BuildRoot: %{_tmppath}/lcr-%{version} Patch0001: 0001-parse-userns-remap-in-daemmon.json.patch Patch0002: 0002-add-rename-json-schema-for-rename-subcommand-in-rest.patch Patch0003: 0003-Add-restful-interface-isula-pull.patch +Patch0004: 0004-use-vsnprintf-to-replace-vsprintf.patch %define lxcver 4.0.3-2021112501 @@ -103,6 +104,12 @@ rm -rf %{buildroot} %{_includedir}/%{_inner_name}/*.h %changelog +* Thu Jun 16 2022 haozi007 - 2.0.7-4 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: use vsnprintf replace vsprintf + * Mon Apr 18 2022 wangfengtu - 2.0.7-3 - Type:enhancement - ID:NA