commit e16ce03196a7a42e94aaf2f2d0e2e15e7b9ae281
parent 77ec5d267bf9bf77a5270ea6be32cee37387c1b1
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 23 Nov 2015 10:30:31 +0100
Minor fix of the ssp_rng deserialisation
During the CXX RNG deserialisation, the stream data were temporary
stored into a buffer of N bytes with the "fgets" function. One assumed
that "fgets" reads up to N bytes while at most N-1 bytes are read; the
last one is reserved by the '\0' character. It was thus unnecessary to
prevent buffer overflow, by explicitly using a size of N-1 in the
"fgets" function.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ssp_rng.c b/src/ssp_rng.c
@@ -302,7 +302,7 @@ rng_cxx_read(void* data, FILE* file)
char* s;
RNG* rng = (RNG*)data;
ASSERT(rng);
- while((s = fgets(buf, (int)sizeof(buf)-1 /*'\0'*/, file))) {
+ while((s = fgets(buf, (int)sizeof(buf), file))) {
stream << std::string(s);
if(s[strlen(s)-1] == '\n') break;
}