strlen_overflow.c 418 B

1234567891011121314151617181920
  1. /* https://github.com/cirosantilli/linux-kernel-module-cheat#config_fortify_source */
  2. #include <linux/kernel.h>
  3. #include <linux/module.h>
  4. #include <linux/string.h>
  5. static int myinit(void)
  6. {
  7. /* Missing terminaing NUL '\0'. */
  8. char buf[] = {'p', 'w', 'n'};
  9. pr_info("%llu\n", (long long unsigned)strlen(buf));
  10. return 0;
  11. }
  12. static void myexit(void) {}
  13. module_init(myinit)
  14. module_exit(myexit)
  15. MODULE_LICENSE("GPL");