summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Larson <mike@vyatta.com>2010-11-29 13:19:29 -0800
committerMichael Larson <mike@vyatta.com>2010-11-29 13:19:29 -0800
commit47783a51d51a6f07c743a28f0ebe50a05a5c1002 (patch)
tree7c6023ad0adf863aef7a6f4239593029b88c9e53
parentba538dbc62f11e8f1000248b4caf96f5c967dfe0 (diff)
downloadvyatta-cfg-47783a51d51a6f07c743a28f0ebe50a05a5c1002.tar.gz
vyatta-cfg-47783a51d51a6f07c743a28f0ebe50a05a5c1002.zip
add limit check on stdout capture (8192 characters).
-rw-r--r--src/cli_new.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cli_new.c b/src/cli_new.c
index 9576047..f3cfa3a 100644
--- a/src/cli_new.c
+++ b/src/cli_new.c
@@ -2570,9 +2570,11 @@ system_out(const char *cmd, const char **outbuf)
char buf[8192];
memset(buf,'\0',8192);
close(cp[1]);
- while (read(cp[0], &buf, 8192) > 0) {
+ int ct = 0, total = 0;
+ while ((ct = read(cp[0], &buf, 8192)) > 0 && (total < 8192)) {
strcat((char*)*outbuf,buf);
memset(buf,'\0',8192);
+ total += ct;
}
//now wait on child to kick the bucket