diff options
author | Stef Walter <stef@thewalter.net> | 2013-07-18 06:48:14 +0200 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2013-07-18 13:04:37 +0200 |
commit | b03be8429847451ddf25508b3dc3c520e96a2cc3 (patch) | |
tree | 333e6263604d86906a9332f493c9b5917955fcca /p11-kit/util.c | |
parent | 2a69ff5691e114362564a2ab572cd4b3b20dcc27 (diff) |
Fix p11_kit_space_strlen() result when empty string
https://bugzilla.redhat.com/show_bug.cgi?id=985416
Diffstat (limited to 'p11-kit/util.c')
-rw-r--r-- | p11-kit/util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/p11-kit/util.c b/p11-kit/util.c index 14c24f6..1124876 100644 --- a/p11-kit/util.c +++ b/p11-kit/util.c @@ -86,13 +86,13 @@ size_t p11_kit_space_strlen (const unsigned char *string, size_t max_length) { - size_t i = max_length - 1; + size_t i = max_length; assert (string); - while (i > 0 && string[i] == ' ') + while (i > 0 && string[i - 1] == ' ') --i; - return i + 1; + return i; } /** |