From 8a7880af2e415ca64358bedc05dc1d6807d08f1c Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 1 Jun 2016 14:44:30 +0100 Subject: [PATCH] BUG: ensightBinaryStream: avoid overflow. Fixes #132 --- .../dataConversion/foamToEnsight/ensightBinaryStream.H | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H index a85c911ebe..d343567722 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -97,8 +97,8 @@ public: virtual void write(const char* val) { - char buffer[80] = {0}; - strcpy(buffer, val); + char buffer[80]; + strncpy(buffer, val, 80); str_().write(buffer, 80*sizeof(char)); }