#3907 closed defect (fixed)
gbox_to_string: snprintf warning
Reported by: | Algunenano | Owned by: | strk |
---|---|---|---|
Priority: | low | Milestone: | PostGIS 2.2.6 |
Component: | liblwgeom | Version: | master |
Keywords: | Cc: |
Description
GCC 7.2 warning in gbox_to_string:
g_box.c: In function 'gbox_to_string' g_box.c:421:21: warning: '))' directive output may be truncated writing 2 bytes into a region of size between 0 and 105 [-Wformat-truncation=] snprintf(str, sz, "GBOX((%.8g,%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->zmin, gbox->mmin, gbox->xmax, gbox->ymax, gbox->zmax, gbox->mmax); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/stdio.h:862:0, from liblwgeom_internal.h:40, from g_box.c:29: /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 26 and 138 bytes into a destination of size 128 return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The destination buffer is set too small to handle the max size of the string so it might get truncated.
Github PR: https://github.com/postgis/postgis/pull/165
Note:
See TracTickets
for help on using tickets.
In 15996: