diff options
author | Tim Ledbetter <timledbetter@gmail.com> | 2023-05-22 23:22:30 +0100 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-05-23 01:42:04 +0200 |
commit | 5dfb4e8066701de991854268f1f6d49d735141c9 (patch) | |
tree | 852194ee64e861cfd2972dec22d3d67142a1e7b6 /Userland/Libraries | |
parent | ae5d1d5a2572fa895fb38b5e3e50ed3501ba86fe (diff) | |
download | serenity-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.cpp | 2 |
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; } |