summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs/src/imfs/imfs_gtkn.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libfs/src/imfs/imfs_gtkn.c')
-rw-r--r--cpukit/libfs/src/imfs/imfs_gtkn.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cpukit/libfs/src/imfs/imfs_gtkn.c b/cpukit/libfs/src/imfs/imfs_gtkn.c
index 09f1ab0174..b15b2f1136 100644
--- a/cpukit/libfs/src/imfs/imfs_gtkn.c
+++ b/cpukit/libfs/src/imfs/imfs_gtkn.c
@@ -26,6 +26,7 @@
IMFS_token_types IMFS_get_token(
const char *path,
+ int pathlen,
char *token,
int *token_len
)
@@ -38,7 +39,7 @@ IMFS_token_types IMFS_get_token(
* Copy a name into token. (Remember NULL is a token.)
*/
c = path[i];
- while ( (!IMFS_is_separator(c)) && (i <= IMFS_NAME_MAX) ) {
+ while ( (!IMFS_is_separator(c)) && (i < pathlen) && (i <= IMFS_NAME_MAX) ) {
token[i] = c;
@@ -58,7 +59,7 @@ IMFS_token_types IMFS_get_token(
if ( i == 0 ) {
token[i] = c;
- if ( token[i] != '\0' ) {
+ if ( (token[i] != '\0') && pathlen ) {
i++;
type = IMFS_CURRENT_DIR;
} else {