cks-devl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cks-devl] problem in cks_config.c


From: Francisco Jesus Monserrat Coll
Subject: [cks-devl] problem in cks_config.c
Date: Fri, 14 Sep 2001 03:06:58 +0200

 Hello,

 There is a small problem in the read_config function used
to read the config file. The lines are read with fgets, so
the last character ("\n") of the lines was copied to the 
buffer "line", but never deleted.

One quick fix is change:

                        name = (char *)strtok(line," ");
                        value = (char *)strtok('\0',"\0");

                        if(memcmp(name,"bind_ip",7) == 0)
for
                        name = (char *)strtok(line," ");
                        value = (char *)strtok('\0',"\0");
                        value[strlen(value)-1] = '\0' ;
                        
                        if(memcmp(name,"bind_ip",7) == 0)

 So we replace '\n' by '\0' fixing the problem.

The patch is small:

diff -uNr cks/src/cks_config.c cks.changes/src/cks_config.c
--- cks/src/cks_config.c        Tue Sep  4 06:47:08 2001
+++ cks.changes/src/cks_config.c        Fri Sep 14 02:59:26 2001
@@ -51,6 +51,7 @@

                         name = (char *)strtok(line," ");
                         value = (char *)strtok('\0',"\0");
+                       value[strlen(value)-1] = '\0' ;

                        if(memcmp(name,"bind_ip",7) == 0)
                         {


I'm going to register a ssh public key for sending the patch to the 
CVS repository


bye


 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]