fix-Wformat-security-warnings.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From 8e57c21b3b707c2a81695384688c46faa1d51da8 Mon Sep 17 00:00:00 2001
  2. From: Michael Orlitzky <michael@orlitzky.com>
  3. Date: Wed, 10 Aug 2016 15:52:30 -0400
  4. Subject: [PATCH 1/1] fileIO.c: add format strings to sprintf calls.
  5. Two calls to sprintf() in fileIO.c were missing the trivial format
  6. string "%s". This caused warnings with -Wformat-security, and build
  7. failures with -Werror=format-security. Those two calls are now fixed.
  8. Gentoo-Bug: 521016
  9. ---
  10. fileIO.c | 4 ++--
  11. 1 file changed, 2 insertions(+), 2 deletions(-)
  12. diff --git a/fileIO.c b/fileIO.c
  13. index a6c535a..1916a46 100644
  14. --- a/fileIO.c
  15. +++ b/fileIO.c
  16. @@ -92,7 +92,7 @@ char *doSave(char *filename) {
  17. n++;
  18. choices = realloc(choices, n*sizeof(char *));
  19. choices[n-1] = malloc(256);
  20. - sprintf(choices[n-1], d->d_name);
  21. + sprintf(choices[n-1], "%s", d->d_name);
  22. }
  23. closedir(dir);
  24. @@ -178,7 +178,7 @@ void load(char *filename)
  25. n++;
  26. choices = realloc(choices, n*sizeof(char *));
  27. choices[n-1] = malloc(256);
  28. - sprintf(choices[n-1], d->d_name);
  29. + sprintf(choices[n-1], "%s", d->d_name);
  30. }
  31. closedir(dir);
  32. --
  33. 2.7.3