summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-11-05 16:07:36 (EST)
committer Patrick McDermott <pj@pehjota.net>2017-11-05 16:07:36 (EST)
commit86c766d25c85efbe8efb1dd728783bd1080b7e23 (patch)
tree12e1b783480184195322eb2f446f459cfd1e8af5 /src/utils
parent6a2a379a03e2b3cd173f4430895465606953b6b5 (diff)
downloadmarquee-86c766d25c85efbe8efb1dd728783bd1080b7e23.zip
marquee-86c766d25c85efbe8efb1dd728783bd1080b7e23.tar.gz
marquee-86c766d25c85efbe8efb1dd728783bd1080b7e23.tar.bz2
mq_html_document*(): Don't dereference styles pointer if NULL
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/html.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/utils/html.c b/src/utils/html.c
index 936ba05..95d7cdc 100644
--- a/src/utils/html.c
+++ b/src/utils/html.c
@@ -210,7 +210,9 @@ mq_html_document(const gchar *title, const gchar *styles,
len += strlen(title);
len += strlen("</title>\n<style>\n");
len += strlen(global_styles);
- len += strlen(styles);
+ if (styles) {
+ len += strlen(styles);
+ }
len += strlen("</style>\n");
if (head_tags) {
len += strlen(head_tags);
@@ -233,7 +235,9 @@ mq_html_document(const gchar *title, const gchar *styles,
ptr = g_stpcpy(ptr, title);
ptr = g_stpcpy(ptr, "</title>\n<style>\n");
ptr = g_stpcpy(ptr, global_styles);
- ptr = g_stpcpy(ptr, styles);
+ if (styles) {
+ ptr = g_stpcpy(ptr, styles);
+ }
ptr = g_stpcpy(ptr, "</style>\n");
if (head_tags) {
ptr = g_stpcpy(ptr, head_tags);
@@ -266,7 +270,9 @@ mq_html_document_v(const gchar *title, const gchar *styles,
len += strlen(title);
len += strlen("</title>\n<style>\n");
len += strlen(global_styles);
- len += strlen(styles);
+ if (styles) {
+ len += strlen(styles);
+ }
len += strlen("</style>\n");
if (head_tags) {
len += strlen(head_tags);
@@ -287,7 +293,9 @@ mq_html_document_v(const gchar *title, const gchar *styles,
ptr = g_stpcpy(ptr, title);
ptr = g_stpcpy(ptr, "</title>\n<style>\n");
ptr = g_stpcpy(ptr, global_styles);
- ptr = g_stpcpy(ptr, styles);
+ if (styles) {
+ ptr = g_stpcpy(ptr, styles);
+ }
ptr = g_stpcpy(ptr, "</style>\n");
if (head_tags) {
ptr = g_stpcpy(ptr, head_tags);