Fix bugs and improve error handling in emerg-shutdown#359
Open
assisted-by-ai wants to merge 1 commit intoKicksecure:masterfrom
Open
Fix bugs and improve error handling in emerg-shutdown#359assisted-by-ai wants to merge 1 commit intoKicksecure:masterfrom
assisted-by-ai wants to merge 1 commit intoKicksecure:masterfrom
Conversation
- Fix print() writing NUL terminator to fd (off-by-one in strlen+1) - Fix load_list() hardcoding "," separator instead of using sep param, breaking pipe-separated key alias parsing - Add missing exit() after kill_system() in paranoid mode and --instant-shutdown to prevent fall-through on syscall failure - Fix memory leak of arg_copy on early return in load_list() - Fix overly strict device key support check: require any alias per group to be supported, not all aliases - Add NULL check for empty --timeout= value to prevent NULL deref - Remove duplicate stdbool.h include - Initialize console_fd to -1 instead of 0 (stdin) https://claude.ai/code/session_016o12KW3j7F1dUBsXBXjfQg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses several bugs and improves error handling in the emergency shutdown utility.
Key changes:
#include <stdbool.h>which was not needed0to-1to properly represent an uninitialized file descriptor+ 1fromstrlen(str)in theprint()function to avoid writing the null terminatorfree(arg_copy)whenstrtok()returns NULL inload_list()to prevent memory leaks on early return","to use thesepvariable in the secondstrtok()call for consistencyhw_monitor()to correctly detect when a key group is supported (changed from checking if key is NOT supported to checking if it IS supported)exit(0)afterkill_system()calls to ensure proper program terminationarg_partinfifo_monitor()to validate that the timeout value is not empty before parsing itThese changes improve code correctness, prevent resource leaks, and enhance error handling robustness.
https://claude.ai/code/session_016o12KW3j7F1dUBsXBXjfQg