1 Star 0 Fork 98

Mingtai/systemd_1

forked from src-openEuler/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-nss-systemd-fix-alignment-of-gr_mem.patch 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
From 649e83bb995eb067cce3e70f50e5d3ab54c9d47d Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Fri, 31 Dec 2021 06:59:42 +0900
Subject: [PATCH] nss-systemd: fix alignment of gr_mem
Follow-up for 1e65eb8f9b7d567462030b2e625998d77677e636.
Fixes #21935.
(cherry picked from commit 420a35c1fadfb4d67be6316436233d98b5688de5)
(cherry picked from commit 9c8bc0451ab2393f3b9b689e46e1b05e9f6dad35)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/649e83bb995eb067cce3e70f50e5d3ab54c9d47d
---
src/nss-systemd/nss-systemd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/nss-systemd/nss-systemd.c b/src/nss-systemd/nss-systemd.c
index 7aea3652c4..36486b96e3 100644
--- a/src/nss-systemd/nss-systemd.c
+++ b/src/nss-systemd/nss-systemd.c
@@ -238,7 +238,7 @@ static enum nss_status copy_synthesized_group(
required += strlen(src->gr_passwd) + 1;
required += sizeof(char*); /* ...but that NULL still needs to be stored into the buffer! */
- if (buflen < required) {
+ if (buflen < ALIGN(required)) {
*errnop = ERANGE;
return NSS_STATUS_TRYAGAIN;
}
@@ -250,7 +250,7 @@ static enum nss_status copy_synthesized_group(
/* String fields point into the user-provided buffer */
dest->gr_name = buffer;
dest->gr_passwd = stpcpy(dest->gr_name, src->gr_name) + 1;
- dest->gr_mem = (char **) stpcpy(dest->gr_passwd, src->gr_passwd) + 1;
+ dest->gr_mem = ALIGN_PTR(stpcpy(dest->gr_passwd, src->gr_passwd) + 1);
*dest->gr_mem = NULL;
return NSS_STATUS_SUCCESS;
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangmingtaip/systemd_1.git
git@gitee.com:yangmingtaip/systemd_1.git
yangmingtaip
systemd_1
systemd_1
master

搜索帮助