Skip to content

Commit ff8aece

Browse files
authored
Make the strlen check against sizeof allow for NULL char
1 parent 1d5dcc7 commit ff8aece

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/driver.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ driver_init(struct error *err, struct dxcore_context *dxcore, const char *root,
8989
.gid = gid,
9090
.nvml_dl = NULL,
9191
};
92-
if (strlen(root) > sizeof(ctx->root)) {
92+
if (strlen(root) >= sizeof(ctx->root)) {
9393
error_setx(err, "root path too long (max %zu bytes)", sizeof(ctx->root) - 1);
9494
goto fail;
9595
}

0 commit comments

Comments
 (0)