patch-lz4jsoncat_c 621 B

123456789101112131415161718192021222324
  1. $OpenBSD: patch-lz4jsoncat_c,v 1.1.1.1 2016/04/04 11:26:22 jca Exp $
  2. Fix little endian assumption.
  3. --- lz4jsoncat.c.orig Fri Apr 1 15:32:34 2016
  4. +++ lz4jsoncat.c Fri Apr 1 19:00:45 2016
  5. @@ -27,6 +27,7 @@
  6. #include <string.h>
  7. #include <stdlib.h>
  8. #include <stdint.h>
  9. +#include <endian.h>
  10. #include "lz4.h"
  11. @@ -61,7 +62,7 @@ int main(int ac, char **av)
  12. fprintf(stderr, "%s: not a mozLZ4a file\n", *av);
  13. exit(1);
  14. }
  15. - size_t outsz = *(uint32_t *) (map + 8);
  16. + size_t outsz = le32toh(*(uint32_t *) (map + 8));
  17. char *out = malloc(outsz);
  18. if (!out) {
  19. fprintf(stderr, "Cannot allocate memory\n");