Commit e50cccfc authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Fix buffer overflow on xstrdup()

This commit fixes #6.
parent d6be8429
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ xstrdup(const char* str) {
    sz = XMIN(strlen(str) + 1, XMAX_STRING_LENGTH);
    res = (char*) xmalloc(sz);
    strncpy(res, str, sz);
    res[sz] = '\0';
    res[sz-1] = '\0';

    return res;
}