Procházet zdrojové kódy

vccd: fix a bug of libreadconf

intirain před 4 roky
rodič
revize
5fcb6b8ba7
4 změnil soubory, kde provedl 6 přidání a 6 odebrání
  1. 1 1
      Makefile
  2. 1 1
      include/vcc/version.h
  3. 2 2
      libreadconf/do_op_set.c
  4. 2 2
      libreadconf/include/port.h

+ 1 - 1
Makefile

@@ -1,6 +1,6 @@
 VCCD_MAJOR 		= 0
 VCCD_MINOR 		= 3
-VCCD_PATCH 		= 3
+VCCD_PATCH 		= 4
 VCCD_COMPILE_TIME 	= $(shell date)
 VCCD_COMPILE_BY 	= $(shell whoami)
 

+ 1 - 1
include/vcc/version.h

@@ -1 +1 @@
-#define VCCD_VERSION "vccd 0.3.3 Fri Mar 11 22:12:21 CST 2022 root"
+#define VCCD_VERSION "vccd 0.3.4 Sat Mar 12 11:50:37 CST 2022 root"

+ 2 - 2
libreadconf/do_op_set.c

@@ -239,9 +239,9 @@ static char *get_conf_field(char *buffer, int *len) {
 	}
 
 	*len = len_of(bufinline);
-	retb = readconf_malloc(*len);
+	retb = readconf_malloc(*len + 1);
 
-	strncpy(retb, bufinline, *len);
+	strcpy(retb, bufinline);
 
 	return retb;
 }

+ 2 - 2
libreadconf/include/port.h

@@ -49,9 +49,9 @@
 extern int getbyte_fd;
 
 #define readconf_getbyte() ({			\
-	char _c;				\
+	char _c = -1;				\
 	if (read(getbyte_fd, &_c, 1) == 0) 	\
-		_c = -1;			\
+		_c = 0;				\
 	_c;					\
 })