patch-komi_c 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. $OpenBSD: patch-komi_c,v 1.1 2008/10/30 23:08:31 espie Exp $
  2. --- komi.c.orig Mon Aug 9 22:07:21 2004
  3. +++ komi.c Fri Oct 31 00:05:45 2008
  4. @@ -30,7 +30,6 @@
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. -#include <malloc.h>
  9. #include <math.h>
  10. #include <time.h>
  11. @@ -2875,8 +2874,8 @@ void loadsound(Mix_Chunk ** thesound, char * directory
  12. if (strlen(directory) + strlen(filename) >= sizeof(fullpath)) // Check for buffer overflow on fullpath
  13. {
  14. fprintf(stderr, "Fatal error while loading %s:\n", filename);
  15. - fprintf(stderr, "Size of directory name (%d chars) plus size of file name (%d chars)\n", strlen(directory), strlen(filename));
  16. - fprintf(stderr, "is too long (over %d chars), and would cause a buffer overflow...\n", sizeof(fullpath) - 1);
  17. + fprintf(stderr, "Size of directory name (%zu chars) plus size of file name (%zu chars)\n", strlen(directory), strlen(filename));
  18. + fprintf(stderr, "is too long (over %zu chars), and would cause a buffer overflow...\n", sizeof(fullpath) - 1);
  19. cleanexit(1);
  20. }
  21. strcpy(fullpath, directory);
  22. @@ -3276,8 +3275,8 @@ void screenshot (SDL_Surface * surface, char * directo
  23. if (strlen(directory) + strlen(filename) >= sizeof(fullpath)) // Check for buffer overflow on fullpath
  24. {
  25. fprintf(stderr, "Error while saving %s:\n", filename);
  26. - fprintf(stderr, "Size of directory name (%d chars) plus size of file name (%d chars)\n", strlen(directory), strlen(filename));
  27. - fprintf(stderr, "is too long (over %d chars), and would cause a buffer overflow...\n", sizeof(fullpath) - 1);
  28. + fprintf(stderr, "Size of directory name (%zu chars) plus size of file name (%zu chars)\n", strlen(directory), strlen(filename));
  29. + fprintf(stderr, "is too long (over %zu chars), and would cause a buffer overflow...\n", sizeof(fullpath) - 1);
  30. return;
  31. }
  32. strcpy(fullpath, directory);
  33. @@ -3625,8 +3624,8 @@ void saveprefs (char * directory, char * filename)
  34. if (strlen(directory) + strlen(filename) >= sizeof(fullpath)) // Check for buffer overflow on fullpath
  35. {
  36. fprintf(stderr, "Error while saving %s:\n", filename);
  37. - fprintf(stderr, "Size of directory name (%d chars) plus size of file name (%d chars)\n", strlen(directory), strlen(filename));
  38. - fprintf(stderr, "is too long (over %d chars), and would cause a buffer overflow...\n", sizeof(fullpath) - 1);
  39. + fprintf(stderr, "Size of directory name (%zu chars) plus size of file name (%zu chars)\n", strlen(directory), strlen(filename));
  40. + fprintf(stderr, "is too long (over %zu chars), and would cause a buffer overflow...\n", sizeof(fullpath) - 1);
  41. return;
  42. }
  43. strcpy(fullpath, directory);
  44. @@ -3662,8 +3661,8 @@ void loadprefs (char * directory, char * filename)
  45. if (strlen(directory) + strlen(filename) >= sizeof(fullpath)) // Check for buffer overflow on fullpath
  46. {
  47. fprintf(stderr, "Error while loading %s:\n", filename);
  48. - fprintf(stderr, "Size of directory name (%d chars) plus size of file name (%d chars)\n", strlen(directory), strlen(filename));
  49. - fprintf(stderr, "is too long (over %d chars), and would cause a buffer overflow...\n", sizeof(fullpath) - 1);
  50. + fprintf(stderr, "Size of directory name (%zu chars) plus size of file name (%zu chars)\n", strlen(directory), strlen(filename));
  51. + fprintf(stderr, "is too long (over %zu chars), and would cause a buffer overflow...\n", sizeof(fullpath) - 1);
  52. return;
  53. }
  54. strcpy(fullpath, directory);
  55. @@ -3740,8 +3739,8 @@ int playmusic (char * directory, char * filename, int
  56. if (strlen(directory) + strlen(filename) >= sizeof(fullpath)) // Check for buffer overflow on fullpath
  57. {
  58. fprintf(stderr, "Error while loading %s:\n", filename);
  59. - fprintf(stderr, "Size of directory name (%d chars) plus size of file name (%d chars)\n", strlen(directory), strlen(filename));
  60. - fprintf(stderr, "is too long (over %d chars), and would cause a buffer overflow...\n", sizeof(fullpath) - 1);
  61. + fprintf(stderr, "Size of directory name (%zu chars) plus size of file name (%zu chars)\n", strlen(directory), strlen(filename));
  62. + fprintf(stderr, "is too long (over %zu chars), and would cause a buffer overflow...\n", sizeof(fullpath) - 1);
  63. return 1;
  64. }
  65. strcpy(fullpath, directory);