Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. diff --git a/transports/janus_http.c b/transports/janus_http.c
  2. old mode 100644
  3. new mode 100755
  4. index 3d1ef95..a16eb5d
  5. --- a/transports/janus_http.c
  6. +++ b/transports/janus_http.c
  7. @@ -386,7 +386,7 @@ static struct MHD_Daemon *janus_http_create_daemon(gboolean admin, char *path,
  8. fseek(pem, 0L, SEEK_END);
  9. size_t size = ftell(pem);
  10. fseek(pem, 0L, SEEK_SET);
  11. - cert_pem_bytes = g_malloc0(size);
  12. + cert_pem_bytes = g_malloc0(size + 1);
  13. char *index = cert_pem_bytes;
  14. int read = 0, tot = size;
  15. while((read = fread(index, sizeof(char), tot, pem)) > 0) {
  16. @@ -394,13 +394,14 @@ static struct MHD_Daemon *janus_http_create_daemon(gboolean admin, char *path,
  17. index += read;
  18. }
  19. fclose(pem);
  20. + cert_pem_bytes[size]='\0';
  21. }
  22. FILE *key = fopen(server_key, "rb");
  23. if(key) {
  24. fseek(key, 0L, SEEK_END);
  25. size_t size = ftell(key);
  26. fseek(key, 0L, SEEK_SET);
  27. - cert_key_bytes = g_malloc0(size);
  28. + cert_key_bytes = g_malloc0(size + 1);
  29. char *index = cert_key_bytes;
  30. int read = 0, tot = size;
  31. while((read = fread(index, sizeof(char), tot, key)) > 0) {
  32. @@ -408,6 +409,7 @@ static struct MHD_Daemon *janus_http_create_daemon(gboolean admin, char *path,
  33. index += read;
  34. }
  35. fclose(key);
  36. + cert_key_bytes[size]='\0';
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement