Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed off-by-one in textual_seterrmsg

  • Loading branch information...
commit ac9c2a2f7dba6827be8975afcc327f5728ae4534 1 parent d269bf1
@alk alk authored committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 libmemc.c
View
4 libmemc.c
@@ -762,10 +762,10 @@ static int parse_value_line(char *header, uint32_t* flag, size_t* size, char** d
return 0;
}
-static char* textual_seterrmsg(struct Server* server, char* messagePrefix) {
+static void textual_seterrmsg(struct Server* server, char* messagePrefix) {
char *endOfMsg = (strstr(server->buffer, "\r\n"));
size_t toCopy = (endOfMsg - server->buffer);
- server->errmsg = malloc(strlen(messagePrefix) + toCopy); // freed afer use
+ server->errmsg = malloc(strlen(messagePrefix) + toCopy + 1); // freed afer use
memcpy(server->errmsg, messagePrefix, strlen(messagePrefix) + 1);
strncat(server->errmsg, server->buffer, toCopy);
}
Please sign in to comment.
Something went wrong with that request. Please try again.