From 2f9d00075b0d236ecd8431761bb045e6aa088001 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 17 Sep 2026 21:20:22 +0200 Subject: twostep solver (wip) --- src/solvers/coord/gendata.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/solvers/coord') diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h index edf6ce6..81ab842 100644 --- a/src/solvers/coord/gendata.h +++ b/src/solvers/coord/gendata.h @@ -24,16 +24,25 @@ gendata_coord_dispatch( unsigned char *buf ) { + size_t r; coord_t *coord; multicoord_t *mcoord; parse_coord_and_trans(coordstr, &coord, &mcoord, NULL); - if (coord != NULL) - return gendata_coord(coord, buf); + if (coord != NULL) { + if (bufsize < gendata_coord(coord, NULL)) + return NISSY_ERROR_BUFFER_SIZE; + r = gendata_coord(coord, buf); + return r == 0 ? NISSY_ERROR_UNKNOWN : (long long)r; + } - if (mcoord != NULL) - return gendata_multicoord(mcoord, buf); + if (mcoord != NULL) { + if (bufsize < gendata_multicoord(mcoord, NULL)) + return NISSY_ERROR_BUFFER_SIZE; + r = gendata_multicoord(mcoord, buf); + return r == 0 ? NISSY_ERROR_UNKNOWN : (long long)r; + } LOG("Error: could not parse coordinate '%s'\n", coordstr); return NISSY_ERROR_INVALID_SOLVER; -- cgit v1.3