Update of /cvsroot/sblim/cmpi-base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25542
Modified Files:
ChangeLog NEWS OSBase_Common.c
Log Message:
Bugs fixed: 1222571 Segmentation Fault on long process command lines.
Index: OSBase_Common.c
===================================================================
RCS file: /cvsroot/sblim/cmpi-base/OSBase_Common.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- OSBase_Common.c 6 Apr 2005 15:17:33 -0000 1.13
+++ OSBase_Common.c 20 Jun 2005 08:54:36 -0000 1.14
@@ -409,6 +409,23 @@
static void addstring(char *** buf, const char * str)
{
int i=0;
+ size_t s;
+ while ((*buf)[i++] != NULL);
+ s = i == 1 ? 0 : strlen((*buf)[i-2]);
+ if (i == 1 || (*buf)[i-2][s-1] == '\n') {
+ *buf=realloc(*buf,(i+1)*sizeof(char*));
+ (*buf)[i-1] = strdup(str);
+ (*buf)[i] = NULL;
+ } else {
+ fprintf(stderr, "******* append (%s)\n", str);
+ (*buf)[i-2]=realloc((*buf)[i-2],s + strlen(str) + 1);
+ strcpy((*buf)[i-2] + s, str);
+ }
+}
+
+static void addstring_noconc(char *** buf, const char * str)
+{
+ int i=0;
while ((*buf)[i++] != NULL);
*buf=realloc(*buf,(i+1)*sizeof(char*));
(*buf)[i-1] = strdup(str);
@@ -449,11 +466,11 @@
while( ( ptr = strchr( ent , c )) != NULL ) {
*ptr='\0';
- addstring( &data , ent );
+ addstring_noconc( &data , ent );
ent = ptr+1;
ptr = NULL ;
}
- addstring( &data , ent );
+ addstring_noconc( &data , ent );
if(str) free(str);
return data;
Index: ChangeLog
===================================================================
RCS file: /cvsroot/sblim/cmpi-base/ChangeLog,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ChangeLog 7 Jun 2005 13:12:42 -0000 1.10
+++ ChangeLog 20 Jun 2005 08:54:36 -0000 1.11
@@ -1,3 +1,9 @@
+2005-06-20 <mih...@dy...>
+
+ * OSBase_Common.c:
+ Bug 1222571: Changed addstring to support lines longer than 4K and
+ added new function addstring_noconc for lines not ending in newlines.
+
2005-06-07 <mihajlov@localhost.localdomain>
* mof/Linux_BaseIndication.registration:
Index: NEWS
===================================================================
RCS file: /cvsroot/sblim/cmpi-base/NEWS,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- NEWS 7 Jun 2005 13:12:42 -0000 1.6
+++ NEWS 20 Jun 2005 08:54:36 -0000 1.7
@@ -1,3 +1,10 @@
+Changes in 1.5.3
+================
+
+Bugs Fixed:
+- 1222571 Fixed segmentation fault on long process command lines.
+
+
Changes in 1.5.2
================
|