From 4acfa934fa8a887d25d873cfc2ea0dcbef8d3822 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 24 May 2015 15:34:31 -1000 Subject: [PATCH] Nicer exception handler --- hecl/blender/CBlenderConnection.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hecl/blender/CBlenderConnection.cpp b/hecl/blender/CBlenderConnection.cpp index bbd3b6978..ce0238158 100644 --- a/hecl/blender/CBlenderConnection.cpp +++ b/hecl/blender/CBlenderConnection.cpp @@ -23,7 +23,11 @@ size_t CBlenderConnection::_readLine(char* buf, size_t bufSz) while (true) { if (readBytes >= bufSz) + { throw std::length_error("Pipe buffer overrun"); + *(buf-1) = '\0'; + return bufSz - 1; + } ssize_t ret = read(m_readpipe[0], buf, 1); if (ret < 0) goto err;