Replace strncpy with strlcpy, as strncpy is not guaranteed to be

NULL-terminated. (thx Colin Wenzel)

svn path=/trunk/netsurf/; revision=13881
This commit is contained in:
Chris Young 2012-04-18 18:54:15 +00:00
parent 692f223d3a
commit b4977fbdcc
2 changed files with 3 additions and 3 deletions

View File

@ -867,13 +867,13 @@ int main(int argc, char** argv)
ami_gui_splash_close(splash_window);
strncpy(script, nsoption_charp(arexx_dir), 1024);
strlcpy(script, nsoption_charp(arexx_dir), 1024);
AddPart(script, nsoption_charp(arexx_startup), 1024);
ami_arexx_execute(script);
netsurf_main_loop();
strncpy(script, nsoption_charp(arexx_dir), 1024);
strlcpy(script, nsoption_charp(arexx_dir), 1024);
AddPart(script, nsoption_charp(arexx_shutdown), 1024);
ami_arexx_execute(script);

View File

@ -115,7 +115,7 @@ char *path_to_url(const char *path)
DevNameFromLock(lock, newpath, sizeof newpath, DN_FULLPATH);
UnLock(lock);
}
else strncpy(newpath, path, sizeof newpath);
else strlcpy(newpath, path, sizeof newpath);
r = malloc(strlen(newpath) + SLEN("file:///") + 1);