Added more fields length safety.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11124 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin
2005-01-29 15:24:49 +00:00
parent bc10030ef0
commit 4220e676ba
+8 -5
View File
@@ -22,13 +22,16 @@ uname(struct utsname *info)
get_system_info(&sinfo);
strcpy(info->sysname, "Haiku");
strlcpy(info->version, sinfo.kernel_build_date, B_OS_NAME_LENGTH);
strlcat(info->version, sinfo.kernel_build_time, B_OS_NAME_LENGTH);
sprintf(info->release, "%lld", sinfo.kernel_version);
strlcpy(info->sysname, "Haiku", sizeof(info->sysname));
strlcpy(info->version, sinfo.kernel_build_date, sizeof(info->version));
strlcat(info->version, sinfo.kernel_build_time, sizeof(info->version));
snprintf(info->release, sizeof(info->release), "%lld", sinfo.kernel_version);
// TODO fill machine field...
strlcpy(info->machine, "unknown", sizeof(info->machine));
// TODO fill nodename field when we have hostname info
strcpy(info->nodename, "unknown");
strlcpy(info->nodename, "unknown", sizeof(info->nodename));
return 0;
}