You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2011/12/15 11:09:25 UTC

svn commit: r1214682 - /incubator/celix/trunk/framework/private/src/manifest.c

Author: abroekhuis
Date: Thu Dec 15 10:09:25 2011
New Revision: 1214682

URL: http://svn.apache.org/viewvc?rev=1214682&view=rev
Log:
Fixed manifest allocation errors.

Modified:
    incubator/celix/trunk/framework/private/src/manifest.c

Modified: incubator/celix/trunk/framework/private/src/manifest.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/manifest.c?rev=1214682&r1=1214681&r2=1214682&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest.c Thu Dec 15 10:09:25 2011
@@ -103,8 +103,10 @@ celix_status_t manifest_read(char *filen
 					char buf[newlen];
 					strcpy(buf, lastline);
 					strncat(buf, lbuf+1, len - 1);
+					buf[newlen] = '\0';
 
 					if (fpeek(file) == ' ') {
+						lastline = realloc(lastline, strlen(buf) + 1);
 						lastline = strcpy(lastline, buf);
 						continue;
 					}
@@ -192,18 +194,19 @@ celix_status_t manifest_readAttributes(M
 				return CELIX_FILE_IO_EXCEPTION;
 			}
 			lineContinued = true;
-			int newlen = strlen(lastLine) + len - 1;
+			int newlen = strlen(lastLine) + len;
 			char buf[newlen];
 			strcpy(buf, lastLine);
 			strncat(buf, lbuf+1, len - 1);
+			buf[newlen] = '\0';
 
 			if (fpeek(file) == ' ') {
+				lastLine = realloc(lastLine, strlen(buf) + 1);
 				lastLine = strcpy(lastLine, buf);
 				continue;
 			}
 			value = (char *) malloc(strlen(buf) + 1);
 			value = strcpy(value, buf);
-			value[strlen(buf)] = '\0';
 			lastLine = NULL;
 		} else {
 			while (lbuf[i++] != ':') {