From 8df721df25864f89772c58a4486314855bf1a37e Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Fri, 28 Oct 2022 04:00:00 +0200 Subject: Fix some compiler warnings & buffer overflows --- src/hyper/spadint.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/hyper/spadint.c') diff --git a/src/hyper/spadint.c b/src/hyper/spadint.c index aa381ba0..df2cd526 100644 --- a/src/hyper/spadint.c +++ b/src/hyper/spadint.c @@ -137,7 +137,7 @@ static void send_pile(openaxiom_sio *sock,char * str) { FILE *f; - char name[512], command[512]; + char name[512], command[532]; sprintf(name, "/tmp/hyper%s.input", oa_getenv("SPADNUM")); f = fopen(name, "w"); @@ -218,7 +218,7 @@ start_user_buffer(HyperDocPage *page) SPAD = (char *) oa_getenv("AXIOM"); if (SPAD == NULL) { - sprintf(SPAD, "/spad/mnt/rios"); + SPAD = "/spad/mnt/rios"; } sprintf(spadbuf, "%s/lib/spadbuf", SPAD); sprintf(complfile, "%s/lib/command.list", SPAD); @@ -542,16 +542,18 @@ print_to_string1(TextNode *command,int * sizeBuf) case openaxiom_StringValue_token: item = return_item(node->data.text); if (item != NULL) { - if (node->space) + if (node->space) { storeChar(' '); + } curr_line = item->lines; while (curr_line != NULL) { for (lcount = 0, s = curr_line->buffer; *s && lcount < item->size; s++, lcount++) { storeChar(funnyUnescape(*s)); } - if (curr_line->len <= item->size && curr_line->next) + if (curr_line->len <= item->size && curr_line->next) { storeChar('\n'); + } curr_line = curr_line->next; } } @@ -1032,8 +1034,9 @@ print_source_to_string1(TextNode *command,int * sizeBuf) s++, lcount++) { storeChar(funnyUnescape(*s)); } - if (curr_line->len <= item->size && curr_line->next) + if (curr_line->len <= item->size && curr_line->next) { storeChar('\n'); + } curr_line = curr_line->next; } } -- cgit v1.2.3