summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e81b7a5)
Why does fgets take an int instead of a size_t? :(
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
die_err("Error opening log file");
for (size_t i = 0; !is_end(exps[i]); i++) {
size_t len = TIMESTAMP_LEN + 1 + strlen(exps[i].message);
die_err("Error opening log file");
for (size_t i = 0; !is_end(exps[i]); i++) {
size_t len = TIMESTAMP_LEN + 1 + strlen(exps[i].message);
+ if (len > INT_MAX - 1)
+ die("message too long");
char *buf = (char *)malloc(len + 2);
if (fgets(buf, len + 1, f) == NULL)
die("Error reading log file");
char *buf = (char *)malloc(len + 2);
if (fgets(buf, len + 1, f) == NULL)
die("Error reading log file");