diff --git a/testing/fatutf8/fatutf8_main.c b/testing/fatutf8/fatutf8_main.c index cc42cae47..e2515bdd7 100644 --- a/testing/fatutf8/fatutf8_main.c +++ b/testing/fatutf8/fatutf8_main.c @@ -146,10 +146,10 @@ int main(int argc, FAR char *argv[]) printf("open successful\n"); len = read(fd, buf, sizeof(buf)); - buf[len] = '\0'; - if (len) + if (len >= 0) { + buf[len] = '\0'; printf("read(\"%s\") successful\n", buf); } else