summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hiredis.h4
-rw-r--r--test.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/hiredis.h b/hiredis.h
index edba658..757677e 100644
--- a/hiredis.h
+++ b/hiredis.h
@@ -98,8 +98,8 @@
* then GNU strerror_r returned an internal static buffer and we \
* need to copy the result into our private buffer. */ \
if (err_str != (buf)) { \
- buf[(len)] = '\0'; \
- strncat((buf), err_str, ((len) - 1)); \
+ strncpy((buf), err_str, ((len) - 1)); \
+ buf[(len)-1] = '\0'; \
} \
} while (0)
#endif
diff --git a/test.c b/test.c
index d5e8217..79148fd 100644
--- a/test.c
+++ b/test.c
@@ -328,12 +328,12 @@ static void test_reply_reader(void) {
}
static void test_free_null(void) {
- void *redisContext = NULL;
+ void *redisCtx = NULL;
void *reply = NULL;
test("Don't fail when redisFree is passed a NULL value: ");
- redisFree(redisContext);
- test_cond(redisContext == NULL);
+ redisFree(redisCtx);
+ test_cond(redisCtx == NULL);
test("Don't fail when freeReplyObject is passed a NULL value: ");
freeReplyObject(reply);