You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

  1. From 955587271031d66e9b7a768e3bb18dae00b60cc6 Mon Sep 17 00:00:00 2001
  2. From: Thierry FOURNIER <tfournier@arpalert.org>
  3. Date: Wed, 8 Jul 2015 00:15:20 +0200
  4. Subject: [PATCH 05/13] BUG/MINOR: http/sample: gmtime/localtime can fail
  5. The man said that gmtime() and localtime() can return a NULL value.
  6. This is not tested. It appears that all the values of a 32 bit integer
  7. are valid, but it is better to check the return of these functions.
  8. However, if the integer move from 32 bits to 64 bits, some 64 values
  9. can be unsupported.
  10. (cherry picked from commit fac9ccfb705702f211f99e67d5f5d5129002086a)
  11. [wt: we only have sample_conv_date() in 1.5]
  12. ---
  13. src/proto_http.c | 2 ++
  14. 1 file changed, 2 insertions(+)
  15. diff --git a/src/proto_http.c b/src/proto_http.c
  16. index 5db64b5..02dc42b 100644
  17. --- a/src/proto_http.c
  18. +++ b/src/proto_http.c
  19. @@ -11249,6 +11249,8 @@ static int sample_conv_http_date(const struct arg *args, struct sample *smp)
  20. curr_date += args[0].data.sint;
  21. tm = gmtime(&curr_date);
  22. + if (!tm)
  23. + return 0;
  24. temp = get_trash_chunk();
  25. temp->len = snprintf(temp->str, temp->size - temp->len,
  26. --
  27. 2.4.6