summaryrefslogtreecommitdiff
path: root/extra/qhull/qhull-2010.1-overflows.patch
blob: df4aa3da19c78965f72031e26dffd486fd3ca2eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From 176c01851026125f574a8223ad49ec58b2b58ec0 Mon Sep 17 00:00:00 2001
From: Johannes Obermayr <johannesobermayr@gmx.de>
Date: Fri, 23 Jul 2010 20:02:19 +0200
Subject: [PATCH] Fix some serious compiler warnings causing build breakage on openSUSE.

---
 src/global.c  |    2 +-
 src/rboxlib.c |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/global.c b/src/global.c
index 3c6141a..4c9f56c 100644
--- a/src/global.c
+++ b/src/global.c
@@ -614,7 +614,7 @@ void qh_initflags(char *command) {
   if (command <= &qh qhull_command[0] || command > &qh qhull_command[0] + sizeof(qh qhull_command)) {
     if (command != &qh qhull_command[0]) {
       *qh qhull_command= '\0';
-      strncat( qh qhull_command, command, sizeof( qh qhull_command));
+      strncat(qh qhull_command, command, sizeof(qh qhull_command)-strlen(qh qhull_command)-1);
     }
     while (*s && !isspace(*s))  /* skip program name */
       s++;
diff --git a/src/rboxlib.c b/src/rboxlib.c
index 4f11d22..17d01ac 100644
--- a/src/rboxlib.c
+++ b/src/rboxlib.c
@@ -124,7 +124,7 @@ int qh_rboxpoints(FILE* fout, FILE* ferr, char* rbox_command) {
   }
 
   *command= '\0';
-  strncat(command, rbox_command, sizeof(command));
+  strncat(command, rbox_command, sizeof(command)-strlen(command)-1);
 
   while (*s && !isspace(*s))  /* skip program name */
     s++;
@@ -346,8 +346,8 @@ int qh_rboxpoints(FILE* fout, FILE* ferr, char* rbox_command) {
     }
   }else if (israndom) {
     seed= (int)time(&timedata);
-    sprintf(seedbuf, " t%d", seed);  /* appends an extra t, not worth removing */
-    strncat(command, seedbuf, sizeof(command));
+    printf(seedbuf, " t%d", seed);  /* appends an extra t, not worth removing */
+    strncat(command, seedbuf, sizeof(command)-strlen(command)-1);
     t= strstr(command, " t ");
     if (t)
       strcpy(t+1, t+3); /* remove " t " */
-- 
1.6.1