Commit 9f4b4c97 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

files: prevent dereferencing a possible (although very unlikely) NULL

Don't catch the NULL earlier, because we do want an error message when
opening the lockfile fails.
No related merge requests found
Showing with 2 additions and 1 deletion
+2 -1
......@@ -252,7 +252,8 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
snprintf(&lockdata[2], 11, "nano %s", VERSION);
strncpy(&lockdata[28], mypwuid->pw_name, 16);
strncpy(&lockdata[68], myhostname, 31);
strncpy(&lockdata[108], origfilename, 768);
if (origfilename != NULL)
strncpy(&lockdata[108], origfilename, 768);
if (modified == TRUE)
lockdata[1007] = 0x55;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment