#include <bundle_internal.h>
#include <amd.h>
#include <signal.h>
+#include <ctype.h>
#include "amd_watchdog_config.h"
#include "amd_watchdog_logger.h"
int ret;
tizen_core_h bt_core;
bundle *b = amd_request_get_bundle(req);
- int pid = atoi(bundle_get_val(b, AUL_K_TARGET_PID));
+ const char *pid_str = bundle_get_val(b, AUL_K_TARGET_PID);
+ pid_t pid;
+
+ if (pid_str == NULL || !isdigit(pid_str[0])) {
+ _E("Failed to get target pid");
+ amd_request_send_result(req, -EINVAL);
+ return -1;
+ }
+
+ pid = atoi(pid_str);
_I("Print BT pid=%d", pid);
ret = tizen_core_find("Backtrace+", &bt_core);
pid_t target_pid;
pid_t target_pgid;
bundle *b;
+ const char *target_pid_str;
sender_uid = amd_request_get_uid(req);
if (sender_uid < REGULAR_UID_MIN)
return AMD_CYNARA_RET_ERROR;
}
- target_pid = atoi(bundle_get_val(b, AUL_K_TARGET_PID));
+ target_pid_str = bundle_get_val(b, AUL_K_TARGET_PID);
+ if (target_pid_str == NULL || !isdigit(target_pid_str[0])) {
+ _E("Failed to get target pid");
+ return AMD_CYNARA_RET_ERROR;
+ }
+
+ target_pid = atoi(target_pid_str);
if (target_pid == 0) {
_E("Wrong target pid %s", bundle_get_val(b, AUL_K_TARGET_PID));
return AMD_CYNARA_RET_ERROR;