aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/coord
diff options
context:
space:
mode:
Diffstat (limited to 'src/solvers/coord')
-rw-r--r--src/solvers/coord/gendata.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h
index 0acf9c0..a48263c 100644
--- a/src/solvers/coord/gendata.h
+++ b/src/solvers/coord/gendata.h
@@ -27,16 +27,25 @@ gendata_coord_dispatch(
27 unsigned char *buf 27 unsigned char *buf
28) 28)
29{ 29{
30 size_t r;
30 coord_t *coord; 31 coord_t *coord;
31 multicoord_t *mcoord; 32 multicoord_t *mcoord;
32 33
33 parse_coord_and_trans(coordstr, &coord, &mcoord, NULL); 34 parse_coord_and_trans(coordstr, &coord, &mcoord, NULL);
34 35
35 if (coord != NULL) 36 if (coord != NULL) {
36 return gendata_coord(coord, buf); 37 if (bufsize < gendata_coord(coord, NULL))
38 return NISSY_ERROR_BUFFER_SIZE;
39 r = gendata_coord(coord, buf);
40 return r == 0 ? NISSY_ERROR_UNKNOWN : (long long)r;
41 }
37 42
38 if (mcoord != NULL) 43 if (mcoord != NULL) {
39 return gendata_multicoord(mcoord, buf); 44 if (bufsize < gendata_multicoord(mcoord, NULL))
45 return NISSY_ERROR_BUFFER_SIZE;
46 r = gendata_multicoord(mcoord, buf);
47 return r == 0 ? NISSY_ERROR_UNKNOWN : (long long)r;
48 }
40 49
41 LOG("Error: could not parse coordinate '%s'\n", coordstr); 50 LOG("Error: could not parse coordinate '%s'\n", coordstr);
42 return NISSY_ERROR_INVALID_SOLVER; 51 return NISSY_ERROR_INVALID_SOLVER;

Generated with cgit - Back to sebastiano.tronto.net