fix OOB memory in lib/log.h

master
Drake 2 years ago
parent 8bd13942e1
commit 8eb62dfcc4

Binary file not shown.

@ -7,7 +7,7 @@
void info(char* ustr, ...) {
char* tstr = GRN "INFO: " CRESET;
char* str = malloc(strlen(tstr) + strlen(ustr));
char* str = malloc(strlen(tstr) + strlen(ustr) + 1);
sprintf(str, "%s%s", tstr, ustr);
//strcat(str, ustr);
@ -18,7 +18,7 @@ void info(char* ustr, ...) {
void warn(char* ustr, ...) {
char* tstr = YEL "WARN: " CRESET;
char* str = malloc(strlen(tstr) + strlen(ustr));
char* str = malloc(strlen(tstr) + strlen(ustr) + 1);
sprintf(str, "%s%s", tstr, ustr);
va_list lst;
@ -28,7 +28,7 @@ void warn(char* ustr, ...) {
void error(char* ustr, ...) {
char* tstr = RED "ERR: " CRESET;
char* str = malloc(strlen(tstr) + strlen(ustr));
char* str = malloc(strlen(tstr) + strlen(ustr) + 1);
sprintf(str, "%s%s", tstr, ustr);
va_list lst;
@ -38,7 +38,7 @@ void error(char* ustr, ...) {
void reqlog(char* ustr, ...) {
char* tstr = WHT "REQ: " CRESET;
char* str = malloc(strlen(tstr) + strlen(ustr));
char* str = malloc(strlen(tstr) + strlen(ustr) + 1);
sprintf(str, "%s%s", tstr, ustr);
va_list lst;

Loading…
Cancel
Save