aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorМяделец Андрей Алексеевич <andreymydelec@gmail.com>2024-04-22 16:26:11 +0700
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2024-04-22 13:11:19 +0200
commit44db29ca7638f2de5bc18bd198adc1802d5199d0 (patch)
tree9de63165c2be167348406e0e39024ac592e7751f
parent2e14003ebb43466f79b13da585abec41ec191284 (diff)
downloadlibmicrohttpd-44db29ca7638f2de5bc18bd198adc1802d5199d0.tar.gz
libmicrohttpd-44db29ca7638f2de5bc18bd198adc1802d5199d0.zip
src/examples/demo{,_https}: fix response buffer overwriting
Adding address offset when copying string. The code was broken by 5821a7f3 ("src/examples/demo{,_https}: added some error checking, fixed compiler warnings").
-rw-r--r--src/examples/demo.c2
-rw-r--r--src/examples/demo_https.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/examples/demo.c b/src/examples/demo.c
index bae63d74..ded2cf01 100644
--- a/src/examples/demo.c
+++ b/src/examples/demo.c
@@ -413,7 +413,7 @@ update_directory (void)
413 update_cached_response (NULL); 413 update_cached_response (NULL);
414 return; 414 return;
415 } 415 }
416 memcpy (rdc.buf, INDEX_PAGE_FOOTER, len); 416 memcpy (&rdc.buf[rdc.off], INDEX_PAGE_FOOTER, len);
417 rdc.off += len; 417 rdc.off += len;
418 initial_allocation = rdc.buf_len; /* remember for next time */ 418 initial_allocation = rdc.buf_len; /* remember for next time */
419 response = 419 response =
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c
index 4b937af1..22821e95 100644
--- a/src/examples/demo_https.c
+++ b/src/examples/demo_https.c
@@ -415,7 +415,7 @@ update_directory (void)
415 update_cached_response (NULL); 415 update_cached_response (NULL);
416 return; 416 return;
417 } 417 }
418 memcpy (rdc.buf, INDEX_PAGE_FOOTER, len); 418 memcpy (&rdc.buf[rdc.off], INDEX_PAGE_FOOTER, len);
419 rdc.off += len; 419 rdc.off += len;
420 initial_allocation = rdc.buf_len; /* remember for next time */ 420 initial_allocation = rdc.buf_len; /* remember for next time */
421 response = 421 response =