diff options
author | Sung-hun Kim <sfoon.kim@samsung.com> | 2024-03-08 14:57:10 +0900 |
---|---|---|
committer | Sung-hun Kim <sfoon.kim@samsung.com> | 2024-03-08 16:32:20 +0900 |
commit | df2a14896ba7c85b3169cab78a2d8cc569fba707 (patch) | |
tree | 84a964407d609a7af3294c479a5b362a40c21a2b | |
parent | b97eaaeb378cf6f254d73f62f14262a1e6d4cb73 (diff) | |
download | crash-worker-accepted/tizen_unified.tar.gz crash-worker-accepted/tizen_unified.tar.bz2 crash-worker-accepted/tizen_unified.zip |
Prevent a possible negative value of an argumentaccepted/tizen/unified/x/20240313.092056accepted/tizen/unified/20240311.170354tizenaccepted/tizen_unified_xaccepted/tizen_unified
If a given argument len has a negative value, it can incur infinite loop.
This patch fixes a coverity issue (cid: 1757405).
Change-Id: Iaafad7cd1afe899de5ec2441ef58398927a472e2
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
-rw-r--r-- | src/shared/util.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index da130e6..eac3506 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -40,6 +40,8 @@ int write_fd(int fd, const void *buf, int len) int count; int total; total = 0; + if (len < 0) + return 0; while (len) { count = write(fd, buf, len); if (count < 0) { |