[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/ksysguard/ksysguardd
From:       John Tapsell <john.tapsell () kdemail ! net>
Date:       2009-11-22 14:50:35
Message-ID: 1258901435.208867.6119.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1052813 by johnflux:

Do not limit the size of the commands


 M  +7 -6      Command.c  


--- trunk/KDE/kdebase/workspace/ksysguard/ksysguardd/Command.c #1052812:1052813
@@ -245,14 +245,15 @@
 void executeCommand( const char* command )
 {
   Command* cmd;
-  char tokenFormat[ 64 ];
-  char token[ 64 ];
+  int i = 0;
+  while(command[i] != 0 && command[i] != ' ' && command[i] != '\t' )
+      i++;
+  if( i <= 0 )
+      return; /* No command give at all */
+  int lengthOfCommand = i;
 
-  sprintf( tokenFormat, "%%%ds", (int)sizeof( token ) - 1 );
-  sscanf( command, tokenFormat, token );
-
   for ( cmd = first_ctnr( CommandList ); cmd; cmd = next_ctnr( CommandList ) ) {
-    if ( strcmp( cmd->command, token ) == 0 ) {
+    if ( strncmp( cmd->command, command, lengthOfCommand ) == 0 && cmd->command[lengthOfCommand] == 0) {
       if ( cmd->isMonitor ) {
         if ( ( time( NULL ) - cmd->sm->time ) >= UPDATEINTERVAL ) {
           cmd->sm->time = time( NULL );
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic