diff options
author | Jason Ekstrand <[email protected]> | 2015-10-02 16:45:48 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-10-02 16:52:47 -0700 |
commit | ef56cf7738ecb25e8c668c509097fc714ca71c96 (patch) | |
tree | 94417116a6147dbf1065089d9a45fd76f9642e6c /src/util | |
parent | 10f97718c353e101c64fa60fcde91e1550e39957 (diff) | |
parent | bf7b6fd3fd6d98305d64ee6224ca9f9e7ba48444 (diff) |
Merge remote-tracking branch 'mesa-public/master' into vulkan
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/ralloc.c | 5 | ||||
-rw-r--r-- | src/util/strndup.c | 5 |
2 files changed, 2 insertions, 8 deletions
diff --git a/src/util/ralloc.c b/src/util/ralloc.c index 01719c888b1..e07fce74f23 100644 --- a/src/util/ralloc.c +++ b/src/util/ralloc.c @@ -359,10 +359,7 @@ ralloc_strndup(const void *ctx, const char *str, size_t max) if (unlikely(str == NULL)) return NULL; - n = strlen(str); - if (n > max) - n = max; - + n = strnlen(str, max); ptr = ralloc_array(ctx, char, n + 1); memcpy(ptr, str, n); ptr[n] = '\0'; diff --git a/src/util/strndup.c b/src/util/strndup.c index ca1c6f53b57..5ceb32fe474 100644 --- a/src/util/strndup.c +++ b/src/util/strndup.c @@ -35,10 +35,7 @@ strndup(const char *str, size_t max) if (!str) return NULL; - n = strlen(str); - if (n > max) - n = max; - + n = strnlen(str, max); ptr = (char *) calloc(n + 1, sizeof(char)); if (!ptr) return NULL; |