summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorTim Ledbetter <timledbetter@gmail.com>2023-05-22 23:22:30 +0100
committerJelle Raaijmakers <jelle@gmta.nl>2023-05-23 01:42:04 +0200
commit5dfb4e8066701de991854268f1f6d49d735141c9 (patch)
tree852194ee64e861cfd2972dec22d3d67142a1e7b6 /Userland/Libraries
parentae5d1d5a2572fa895fb38b5e3e50ed3501ba86fe (diff)
downloadserenity-5dfb4e8066701de991854268f1f6d49d735141c9.zip
LibC: Fix incorrect string length calculation in getsignalbyname()
This makes `kill` and `killall` work correctly with signal names.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibC/signal.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibC/signal.cpp b/Userland/Libraries/LibC/signal.cpp
index 946747c2dd..e61781a87a 100644
--- a/Userland/Libraries/LibC/signal.cpp
+++ b/Userland/Libraries/LibC/signal.cpp
@@ -252,7 +252,7 @@ int getsignalbyname(char const* name)
VERIFY(name);
StringView name_sv { name, strlen(name) };
for (size_t i = 0; i < NSIG; ++i) {
- StringView signal_name { sys_signame[i], sizeof(sys_signame[i]) - 1 };
+ StringView signal_name { sys_signame[i], strlen(sys_signame[i]) };
if (signal_name == name_sv || (name_sv.starts_with("SIG"sv) && signal_name == name_sv.substring_view(3)))
return i;
}