Skip to content

Commit

Permalink
utilities: Fix getenv function
Browse files Browse the repository at this point in the history
This patch fixes a wrong comparison leading to a false failure. We want to
return error if the env var size is bigger than max size and not the other
way around.

Signed-off-by: Nuno Sá <[email protected]>
  • Loading branch information
nunojsa authored and commodo committed Sep 22, 2020
1 parent 1bfc350 commit 5ebe88f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ char * iio_getenv (char * envvar)
len = strnlen(hostname, tmp);

/* Should be smaller than max length */
if (len <= tmp)
if (len == tmp)
goto wrong_str;

/* should be more than "usb:" or "ip:" */
Expand Down

0 comments on commit 5ebe88f

Please sign in to comment.