Valgrind throws me out this error:
==11204== Syscall param write(buf) points to uninitialised byte(s)
==11204== at 0x4109033: write (in /lib/libc-2.13.so)
==1
Your Request
structure has arrays name1
, name2
, etc. which contain null-terminated strings. When you fill them, you don't write past the null terminator. Later when you write the structure to the file, valgrind complains because these bytes are uninitialized. There may also be other uninitialized bytes (for example, padding inserted by the compiler).
This is not necessarily a problem, other than a small security issue: The previous contents of memory, which may hold sensitive information, will get written to the file.
You can memset the structure to 0 before filling its fields to avoid this error.