Skip to content

scan-build complaint on cookie_interface.c #7497

Closed
@bagder

Description

@bagder

Unfortunately, #7490 caused scan-build to yell:

cookie_interface.c: In function ‘main’:
cookie_interface.c:96:53: error: ‘%.0lf’ directive output may be truncated writing between 1 and 310 bytes into a region of size 230 [-Werror=format-truncation=]
     snprintf(nline, sizeof(nline), "%s\t%s\t%s\t%s\t%.0lf\t%s\t%s",
                                                     ^~~~~
cookie_interface.c:96:5: note: ‘snprintf’ output between 70 and 379 bytes into a destination of size 256
     snprintf(nline, sizeof(nline), "%s\t%s\t%s\t%s\t%.0lf\t%s\t%s",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              ".example.com", "TRUE", "/", "FALSE",
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              difftime(time(NULL) + 31337, (time_t)0),
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              "PREF", "hello example, i like you very much!");
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

_Originally posted by @bagder in https://github.com/curl/curl/pull/7490#issuecomment-886606852_

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions