Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix truncation warning for UTM zone snprintf() #44

Merged

Conversation

kmhallen
Copy link

In file included from /home/kmhallen/ros1/ds/src/gps_umd/gps_common/src/utm_odometry_node.cpp:10:
/home/kmhallen/ros1/ds/src/gps_umd/gps_common/include/gps_common/conversions.h: In function ‘void callback(const NavSatFixConstPtr&)’:
/home/kmhallen/ros1/ds/src/gps_umd/gps_common/include/gps_common/conversions.h:188:24: warning: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 4 [-Wformat-truncation=]
  188 |  snprintf(UTMZone, 4, "%d%c", ZoneNumber, UTMLetterDesignator(Lat));
      |                        ^~
/home/kmhallen/ros1/ds/src/gps_umd/gps_common/include/gps_common/conversions.h:188:23: note: directive argument in the range [-2147483647, 2147483647]
  188 |  snprintf(UTMZone, 4, "%d%c", ZoneNumber, UTMLetterDesignator(Lat));
      |                       ^~~~~~
In file included from /usr/include/stdio.h:867,
                 from /usr/include/c++/9/cstdio:42,
                 from /usr/include/c++/9/ext/string_conversions.h:43,
                 from /usr/include/c++/9/bits/basic_string.h:6493,
                 from /usr/include/c++/9/string:55,
                 from /opt/ros/noetic/include/ros/platform.h:38,
                 from /opt/ros/noetic/include/ros/time.h:53,
                 from /opt/ros/noetic/include/ros/ros.h:38,
                 from /home/kmhallen/ros1/ds/src/gps_umd/gps_common/src/utm_odometry_node.cpp:5:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 3 and 13 bytes into a destination of size 4
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@danthony06 danthony06 merged commit 4897221 into swri-robotics:master Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants