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.master
parent
0293eac1d1
commit
9f4b4c975a
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue