if (type != NULL && pkgpath != NULL && pkgid != NULL && teppath != NULL) {
D("args: type=%s, pkgpath=%s, pkgid=%s, teppath=%s\n", type, pkgpath, pkgid, teppath);
- if (strncmp(pkgid, "\\n\\u\\l\\l", 8) == 0) {
- if (strncmp(teppath, "\\n\\u\\l\\l", 8) == 0) {
+ if (strncmp(pkgid, "\\n\\u\\l\\l", strlen("\\n\\u\\l\\l")+1) == 0) {
+ if (strncmp(teppath, "\\n\\u\\l\\l", strlen("\\n\\u\\l\\l")+1) == 0) {
/* Normal install case */
snprintf(buf, len, "pkgcmd -i -q -t %s -p %s -G", type, pkgpath);
} else {
service_name = info.args[0];
D("service name=%s\n", service_name);
- if (strncmp(service_name, "install", 7) == 0) {
+ if (strncmp(service_name, "install", strlen("install")+1) == 0) {
info.receiver_func = appcmd_receiver_default;
info.gen_cmd_func = appcmd_install_gen_shellcmd;
run_appcmd_with_shell_process(&info);
if (info.args[2] != NULL) {
sdb_unlink(info.args[2]);
}
- } else if (strncmp(service_name, "uninstall", 9) == 0) {
+ } else if (strncmp(service_name, "uninstall", strlen("uninstall")+1) == 0) {
info.receiver_func = appcmd_receiver_default;
info.gen_cmd_func = appcmd_uninstall_gen_shellcmd;
run_appcmd_with_shell_process(&info);
- } else if (strncmp(service_name, "appinfo", 7) == 0) {
+ } else if (strncmp(service_name, "appinfo", strlen("appinfo")+1) == 0) {
info.gen_cmd_func = appcmd_appinfo_gen_shellcmd;
info.receiver_func = appcmd_receiver_appinfo;
run_appcmd_with_shell_process(&info);
- } else if (strncmp(service_name, "packageinfo", 11) == 0) {
+ } else if (strncmp(service_name, "packageinfo", strlen("packageinfo")+1) == 0) {
#if APPCMD_USING_PKGMGR
run_appcmd_packageinfo(&info);
#else
info.receiver_func = appcmd_receiver_packageinfo;
run_appcmd_with_shell_process(&info);
#endif
- } else if (strncmp(service_name, "packagelist", 11) == 0) {
+ } else if (strncmp(service_name, "packagelist", strlen("packagelist")+1) == 0) {
info.gen_cmd_func = appcmd_packagelist_gen_shellcmd;
info.receiver_func = appcmd_receiver_packagelist;
run_appcmd_with_shell_process(&info);
- } else if (strncmp(service_name, "appinstallpath", 14) == 0) {
+ } else if (strncmp(service_name, "appinstallpath", strlen("appinstallpath")+1) == 0) {
run_appcmd_appinstallpath(&info);
- } else if (strncmp(service_name, "runapp", 6) == 0) {
+ } else if (strncmp(service_name, "runapp", strlen("runapp")+1) == 0) {
info.receiver_func = appcmd_receiver_default;
info.gen_cmd_func = appcmd_runapp_gen_shellcmd;
run_appcmd_with_shell_process(&info);
- } else if (strncmp(service_name, "rununittestapp", 14) == 0) {
+ } else if (strncmp(service_name, "rununittestapp", strlen("rununittestapp")+1) == 0) {
info.receiver_func = appcmd_receiver_default;
info.gen_cmd_func = appcmd_rununittestapp_gen_shellcmd;
run_appcmd_with_shell_process(&info);
- } else if (strncmp(service_name, "killapp", 7) == 0) {
+ } else if (strncmp(service_name, "killapp", strlen("killapp")+1) == 0) {
info.receiver_func = appcmd_receiver_default;
info.gen_cmd_func = appcmd_killapp_gen_shellcmd;
run_appcmd_with_shell_process(&info);
- } else if (strncmp(service_name, "debugwebapp", 11) == 0) {
+ } else if (strncmp(service_name, "debugwebapp", strlen("debugwebapp")+1) == 0) {
info.gen_cmd_func = appcmd_debugwebapp_gen_shellcmd;
info.receiver_func = appcmd_receiver_debugwebapp;
run_appcmd_with_shell_process(&info);
- } else if (strncmp(service_name, "debugnativeapp", 14) == 0) {
+ } else if (strncmp(service_name, "debugnativeapp", strlen("debugnativeapp")+1) == 0) {
info.gen_cmd_func = appcmd_debugnativeapp_gen_shellcmd;
run_appcmd_with_shell_process(&info);
} else {
D("failed to allocate memory for the parameter\n");
return PLUGIN_CMD_FAIL;
}
- if(!strncmp(in->array_of_parameter[0].v_string.data, "sample-echo", 11)) {
+
+ //the data contains the string sample-echo followed by space and then the user string, hence checking for space.
+ if((in->array_of_parameter[0].v_string.data[11] == ' ')&&(!strncmp(in->array_of_parameter[0].v_string.data, "sample-echo", strlen("sample-echo")))) {
out->array_of_parameter[0].type = type_int32;
out->array_of_parameter[0].v_int32 = PLUGIN_RET_HANDLE;
}
struct stat st;
msg.stat.id = ID_STAT;
- if (cmd && !strncmp(cmd, "pull", 4)) {
+
+ if (cmd && !strncmp(cmd, "pull", strlen(cmd)+1)) {
if (!request_validity_to_plugin(PLUGIN_SYNC_CMD_VERIFY_PULL, path)) {
D("cannot pull files from this path.\n");
msg.stat.mode = 1;
static int is_support_push()
{
- return (!strncmp(g_capabilities.filesync_support, PLUGIN_RET_PUSHPULL, strlen(PLUGIN_RET_PUSHPULL))
- || !strncmp(g_capabilities.filesync_support, PLUGIN_RET_PUSH, strlen(PLUGIN_RET_PUSH)));
+ return (!strncmp(g_capabilities.filesync_support, PLUGIN_RET_PUSHPULL, strlen(PLUGIN_RET_PUSHPULL)+1)
+ || !strncmp(g_capabilities.filesync_support, PLUGIN_RET_PUSH, strlen(PLUGIN_RET_PUSH)+1));
}
static int is_support_pull()
{
- return (!strncmp(g_capabilities.filesync_support, PLUGIN_RET_PUSHPULL, strlen(PLUGIN_RET_PUSHPULL))
- || !strncmp(g_capabilities.filesync_support, PLUGIN_RET_PULL, strlen(PLUGIN_RET_PULL)));
+ return (!strncmp(g_capabilities.filesync_support, PLUGIN_RET_PUSHPULL, strlen(PLUGIN_RET_PUSHPULL)+1)
+ || !strncmp(g_capabilities.filesync_support, PLUGIN_RET_PULL, strlen(PLUGIN_RET_PULL)+1));
}
static int do_send(int s, int noti_fd, char *path, char *buffer)
-/*
+/*
* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
static int is_enable_sdbd_log()
{
- return (!strncmp(g_capabilities.log_enable, PLUGIN_RET_ENABLED, strlen(PLUGIN_RET_ENABLED)));
+ return (!strncmp(g_capabilities.log_enable, PLUGIN_RET_ENABLED, strlen(PLUGIN_RET_ENABLED)+1));
}
int sdb_trace_mask;
apacket *get_apacket(void)
{
apacket *p = malloc(sizeof(apacket));
- if(p == 0) fatal("failed to allocate an apacket");
+ if(p == 0) {
+ // free only being done to resolve SVACE issue.
+ free(p) ;
+ fatal("failed to allocate an apacket");
+ }
memset(p, 0, sizeof(apacket) - MAX_PAYLOAD);
return p;
}
static int is_support_usbproto()
{
- return (!strncmp(g_capabilities.usbproto_support, PLUGIN_RET_ENABLED, strlen(PLUGIN_RET_ENABLED)));
+ return (!strncmp(g_capabilities.usbproto_support, PLUGIN_RET_ENABLED, strlen(PLUGIN_RET_ENABLED)+1));
}
static int is_support_sockproto()
{
- return (!strncmp(g_capabilities.sockproto_support, PLUGIN_RET_ENABLED, strlen(PLUGIN_RET_ENABLED)));
+ return (!strncmp(g_capabilities.sockproto_support, PLUGIN_RET_ENABLED, strlen(PLUGIN_RET_ENABLED)+1));
}
#define EMULATOR_MODEL_NAME "Emulator"
// Get the model name from model_config.xml
ret = get_device_name(model_name, sizeof model_name);
if (ret == 0) {
- if(!strncmp(model_name, EMULATOR_MODEL_NAME, sizeof(EMULATOR_MODEL_NAME))){
+ if(!strncmp(model_name, EMULATOR_MODEL_NAME, strlen("Emulator")+1)){
g_is_emulator = 1;
I("This target type is Emulator\n");
} else {
if (!is_cmd_suffix_denied(arg1) && (cnt == 2)) {
// check if command is used with permitted arguments
for (i = 0; root_commands[0].arguments[i] != NULL; i++) {
- if (!strncmp(tokens[1], root_commands[0].arguments[i], strlen(tokens[1]))){
+ if (!strncmp(tokens[1], root_commands[0].arguments[i], strlen(tokens[1])+1)){
D("found permitted arguments :%s\n", tokens[1]);
ret = 1;
break;
int is_root_commands(const char *command) {
int i = -1;
for(i = 0; root_commands[i].path != NULL; i++) {
- if(!strncmp(root_commands[i].path, command, PATH_MAX)) {
+ if(!strncmp(root_commands[i].path, command, strlen(root_commands[i].path)+1)) {
return i;
}
}
static int is_support_interactive_shell()
{
- return (!strncmp(g_capabilities.intershell_support, PLUGIN_RET_ENABLED, strlen(PLUGIN_RET_ENABLED)));
+ return (!strncmp(g_capabilities.intershell_support, PLUGIN_RET_ENABLED, strlen(PLUGIN_RET_ENABLED)+1));
}
#if 0
static int is_support_rootonoff()
{
- return (!strncmp(g_capabilities.rootonoff_support, PLUGIN_RET_ENABLED, strlen(PLUGIN_RET_ENABLED)));
+ return (!strncmp(g_capabilities.rootonoff_support, PLUGIN_RET_ENABLED, strlen(PLUGIN_RET_ENABLED)+1));
}
void rootshell_service(int fd, void *cookie)
char *arg[5];
char targ[10];
char smarg[10];
- sprintf(targ,"%d",s[1]);
- sprintf(smarg, "%d",rootshell_mode);
+ snprintf(targ, sizeof(targ), "%d", s[1]);
+ snprintf(smarg, sizeof(smarg), "%d", rootshell_mode);
D("SERVICE fd to be used by child process %d",s[1]);
D("SERVICE rootmode to be used by child process %s",smarg);
arg[0]=fname;