[netperf-dev] netperf4 commit notice r67 - trunk/src
raj at netperf.org
raj at netperf.org
Mon Feb 27 17:54:36 PST 2006
Author: raj
Date: 2006-02-27 17:54:34 -0800 (Mon, 27 Feb 2006)
New Revision: 67
Modified:
trunk/src/netlib.c
Log:
Make quite certain that the string returned by netperf_complete_filename
is null-terminated.
Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c 2006-02-27 21:11:21 UTC (rev 66)
+++ trunk/src/netlib.c 2006-02-28 01:54:34 UTC (rev 67)
@@ -140,7 +140,8 @@
CWD, or they specified a full path name, I wonder if we need to
worry about explicit null termination of full? raj 2006-02-27 */
strncpy(full,name,fulllen);
- ret = 0;
+ full[fulllen-1] = '\0';
+ ret = strlen(full);
}
else {
/* very simple, even simplistic - since the stat above didn't
@@ -151,7 +152,8 @@
path[PATH_MAX] = '\0';
if (0 == stat(path,&buf)) {
strncpy(full,path,fulllen);
- ret = 0;
+ full[fulllen-1] = '\0';
+ ret = strlen(full);
}
else {
ret = -1;
More information about the netperf-dev
mailing list