l2tp-no-gnu-extensions.patch 1000 B

123456789101112131415161718192021222324252627282930313233
  1. --- l2tpd-0.70-pre20031121.oorig/avpsend.c 2006-12-28 16:00:26.000000000 +0100
  2. +++ l2tpd-0.70-pre20031121/avpsend.c 2006-12-28 16:21:06.000000000 +0100
  3. @@ -98,19 +98,26 @@ int add_hostname_avp(struct buffer *buf,
  4. int sz = 0;
  5. if(t->lac && t->lac->hostname[0]) {
  6. strncpy(n,t->lac->hostname, sizeof(n));
  7. - sz = strnlen(t->lac->hostname, sizeof(t->lac->hostname));
  8. + sz = strlen(t->lac->hostname);
  9. + if (sz > sizeof(t->lac->hostname))
  10. + sz = sizeof(t->lac->hostname);
  11. }
  12. else if(t->lns && t->lns->hostname[0]) {
  13. strncpy(n,t->lns->hostname, sizeof(n));
  14. - sz = strnlen(t->lns->hostname, sizeof(t->lns->hostname));
  15. + sz = strlen(t->lns->hostname);
  16. + if (sz > sizeof(t->lns->hostname))
  17. + sz = sizeof(t->lns->hostname);
  18. }
  19. else {
  20. if(gethostname(n, STRLEN)) {
  21. strcpy(n,"eriwan");
  22. sz = 6;
  23. }
  24. - else
  25. - sz = strnlen(n, sizeof(n));
  26. + else {
  27. + sz = strlen(n);
  28. + if (sz > sizeof(n))
  29. + sz = sizeof(n);
  30. + }
  31. }
  32. if(add_avp(buf, HOSTNAME_AVP, n, sz, 1))
  33. return 1;