diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-05-02 18:33:22 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-05-02 18:33:22 -0700 |
commit | 6f3abc4e478b9d91c6c3ad41925353bb744e5d2f (patch) | |
tree | 5613be75eebbe0b1262474add9b7133e8838f70f /math.c | |
parent | 62bfb33c545c6afd0cd5ee050168ce1fd461a956 (diff) |
math.c: In function ‘negf’:
math.c:474:36: warning: ‘snprintf’ output may be truncated before the last
format character [-Wformat-truncation=]
474 | snprintf(tmp, sizeof(tmp), "-%s", dispstr);
| ^
math.c:474:5: note: ‘snprintf’ output between 2 and 33 bytes into a
destination of size 32
474 | snprintf(tmp, sizeof(tmp), "-%s", dispstr);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/app/xcalc/-/merge_requests/13>
Diffstat (limited to 'math.c')
-rw-r--r-- | math.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -470,7 +470,7 @@ negf(void) if (dispstr[0]=='-') /* already neg-ed */ strcpy(dispstr,dispstr+1); /* move str left once */ else { /* not neg-ed. add a '-' */ - char tmp[32]; + char tmp[LCD_STR_LEN + 1]; snprintf(tmp, sizeof(tmp), "-%s", dispstr); strlcpy(dispstr, tmp, sizeof(dispstr)); } |