The memset call seems fine, but malloc()'s return value should be checked, as kaylum said. Also, you probably wanted to allocate sz + 1 bytes unless you want unexpected behavior (remember that C strings are NUL-terminated) or unless line will be shorter than tmp. P.S.: casting malloc() to char* (or whatever specific pointer type) is discouraged.
There is no error. Fortify is a tool to alert you of security flaws in you code. A potential for someone to exploit your code. The exploit here is buffer overflow.
@AdamJones The reason why Fortify is telling you that there is a buffer overflow is probably caused by: 1) you don't check for malloc()'s return value (this is a security hole); 2) Fortify recognizes the pattern line = malloc(strlen(tmp)) as this is a security hole in many programs (not the intended behavior wanted by the programmer), but it is not a problem if you actually intended the variable line to hold fewer chars than tmp (rarely the case). I never used Fortify but I suppose this could help.
mallocfailure.memsetcall seems fine, butmalloc()'s return value should be checked, as kaylum said. Also, you probably wanted to allocatesz + 1bytes unless you want unexpected behavior (remember that C strings are NUL-terminated) or unlesslinewill be shorter thantmp. P.S.: castingmalloc()tochar*(or whatever specific pointer type) is discouraged.malloc()'s return value (this is a security hole); 2) Fortify recognizes the patternline = malloc(strlen(tmp))as this is a security hole in many programs (not the intended behavior wanted by the programmer), but it is not a problem if you actually intended the variablelineto hold fewer chars thantmp(rarely the case). I never used Fortify but I suppose this could help.