Skip to content

Commit ffe6d59

Browse files
author
Hubert Badocha
committed
rofs: check for empty string in lookup
JIRA: RTOS-927
1 parent 1533188 commit ffe6d59

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

rofs/rofs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ int rofs_lookup(struct rofs_ctx *ctx, oid_t *dir, const char *name, oid_t *fil,
439439
int res;
440440

441441
fil->port = ctx->oid.port;
442-
if (name == NULL) {
442+
if ((name == NULL) || (name[0] == '\0')) {
443443
return -EINVAL;
444444
}
445445

@@ -448,7 +448,7 @@ int rofs_lookup(struct rofs_ctx *ctx, oid_t *dir, const char *name, oid_t *fil,
448448
}
449449

450450
while (name[len] != '\0') {
451-
while (name[len] == '/' && name[len] != '\0') {
451+
while ((name[len] == '/') && (name[len] != '\0')) {
452452
len++;
453453
}
454454

0 commit comments

Comments
 (0)