[OpenWrt-Devel] [PATCH 3/4] file.c: lift the 4096 bytes line length limit.

Yousong Zhou yszhou4tech at gmail.com
Mon May 25 08:32:42 EDT 2015


Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 file.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/file.c b/file.c
index 81047a4..cf0dfaf 100644
--- a/file.c
+++ b/file.c
@@ -33,7 +33,6 @@
 #include "uci_internal.h"
 
 #define LINEBUF	32
-#define LINEBUF_MAX	4096
 
 /*
  * Fetch a new line from the input stream and resize buffer if necessary
@@ -69,11 +68,10 @@ __private void uci_getln(struct uci_context *ctx, int offset)
 			return;
 		}
 
-		if (pctx->bufsz > LINEBUF_MAX/2)
-			uci_parse_error(ctx, "line too long");
-
 		pctx->bufsz *= 2;
 		pctx->buf = uci_realloc(ctx, pctx->buf, pctx->bufsz);
+		if (!pctx->buf)
+			UCI_THROW(ctx, UCI_ERR_MEM);
 	} while (1);
 }
 
-- 
1.7.10.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list