X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Frootcheck%2Funix-process.c;h=3b873d3920695c842da4d08a917806b0c08290ce;hp=072964e9433036c769e0c489aea26df024d5f759;hb=6ef2f786c6c8ead94841b5f93baf9f43421f08c8;hpb=301048b51990573e58a30dc4a5bb4ec285cad554 diff --git a/src/rootcheck/unix-process.c b/src/rootcheck/unix-process.c index 072964e..3b873d3 100755 --- a/src/rootcheck/unix-process.c +++ b/src/rootcheck/unix-process.c @@ -1,4 +1,5 @@ -/* @(#) $Id$ */ +/* @(#) $Id: ./src/rootcheck/unix-process.c, 2011/09/08 dcid Exp $ + */ /* Copyright (C) 2009 Trend Micro Inc. * All right reserved. @@ -8,11 +9,11 @@ * License (version 2) as published by the FSF - Free Software * Foundation * - * License details at the LICENSE file included with OSSEC or + * License details at the LICENSE file included with OSSEC or * online at: http://www.ossec.net/main/license/ . */ - + #include "shared.h" #include "rootcheck.h" @@ -24,13 +25,13 @@ char *_os_get_runps(char *ps, int mpid) char buf[OS_SIZE_2048 +1]; char command[OS_SIZE_1024 +1]; FILE *fp; - - + + buf[0] = '\0'; command[0] = '\0'; - command[OS_SIZE_1024] = '\0'; - - + command[OS_SIZE_1024] = '\0'; + + snprintf(command, OS_SIZE_1024, "%s -p %d 2> /dev/null", ps, mpid); fp = popen(command, "r"); @@ -58,9 +59,9 @@ char *_os_get_runps(char *ps, int mpid) while(*tmp_str == ' ') tmp_str++; - + nbuf = tmp_str; - + tmp_str = strchr(nbuf, '\n'); if(tmp_str) @@ -86,7 +87,7 @@ void *os_get_process_list() int i = 1; pid_t max_pid = MAX_PID; OSList *p_list = NULL; - + char ps[OS_SIZE_1024 +1]; @@ -109,7 +110,7 @@ void *os_get_process_list() if(!p_list) { merror(LIST_ERROR, ARGV0); - return(NULL); + return(NULL); } @@ -135,11 +136,11 @@ void *os_get_process_list() OSList_AddData(p_list, p_info); } } - + return((void *)p_list); } - - + + #endif /* EOF */