From 7f84fb9489f55b373db819b5117e706c75578300 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 30 May 2013 23:18:34 +0200 Subject: cut http_referer for meta data if longer than 79 chars --- cqrlogo.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cqrlogo.c b/cqrlogo.c index 9b76e5f..06717c5 100644 --- a/cqrlogo.c +++ b/cqrlogo.c @@ -107,6 +107,15 @@ int main(int argc, char **argv) { /* print HTTP header */ printf("Content-Type: image/png\n\n"); + /* cut http_referer, text in png file may have a max length of 79 chars */ + if (strlen(http_referer) > 79) { + if (!rc) { + http_referer = strdup(http_referer); + rc = 1; + } + sprintf(http_referer + 76, "..."); + } + /* print PNG data */ gdk_pixbuf_save_to_buffer (pixbuf, &buffer, &size, "png", NULL, "compression", "9", -- cgit v1.2.3-70-g09d2