patch-Wnn_uum_wnnrc_op_c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. $OpenBSD: patch-Wnn_uum_wnnrc_op_c,v 1.3 2017/04/29 14:31:40 espie Exp $
  2. --- Wnn/uum/wnnrc_op.c.orig
  3. +++ Wnn/uum/wnnrc_op.c
  4. @@ -50,7 +50,8 @@
  5. */
  6. /* uumrc operations */
  7. -#include "stdio.h"
  8. +#include <stdio.h>
  9. +#include <stdlib.h>
  10. #include <ctype.h>
  11. #include <sys/errno.h>
  12. #include <pwd.h>
  13. @@ -61,12 +62,7 @@
  14. #include "rk_spclval.h"
  15. #include "sdefine.h"
  16. #include "sheader.h"
  17. -
  18. -#ifdef BSD42
  19. -#include <strings.h>
  20. -#else
  21. #include <string.h>
  22. -#endif
  23. extern char *getenv();
  24. extern FILE *fopen();
  25. @@ -148,7 +144,7 @@ char *s;
  26. #endif /* defined(SYSVR2) && !defined(AIXV3) */
  27. if(*s != '~' && *s != '@') {
  28. - strcpy(tmp, s);
  29. + strlcpy(tmp, s, sizeof(tmp));
  30. *s = '\0';
  31. noerr = 1;
  32. }else{
  33. @@ -160,7 +156,7 @@ char *s;
  34. #else
  35. if(NULL != (p = strchr(++s1, '/'))){
  36. #endif
  37. - strcpy(tmp, p);
  38. + strlcpy(tmp, p, sizeof(tmp));
  39. *p = '\0';
  40. } else *tmp = '\0';
  41. /* ここまでは準備。s…先頭、s1…2文字目、p…最初の'/'のあったところ
  42. @@ -581,8 +577,8 @@ open_uumrc()
  43. }
  44. strcpy(buf, LIBDIR);
  45. strcat(buf, "/");
  46. - strcat(buf, lang_dir);
  47. - strcat(buf, RCFILE);
  48. + strlcat(buf, lang_dir, sizeof buf);
  49. + strlcat(buf, RCFILE, sizeof buf);
  50. if((fp = fopen(buf, "r")) != NULL){
  51. if(verbose_option) fprintf(stderr, "uumrc: using uumrc %s\r\n", buf);
  52. return fp;