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

getting warnings while compiling master #1036

Closed
umairsiddiqui-digitek opened this issue Sep 8, 2020 · 2 comments
Closed

getting warnings while compiling master #1036

umairsiddiqui-digitek opened this issue Sep 8, 2020 · 2 comments

Comments

@umairsiddiqui-digitek
Copy link

getting warnings while compiling master

        CC  src/tig.o
        CC  src/types.o
        CC  src/string.o
        CC  src/util.o
        CC  src/map.o
        CC  src/argv.o
        CC  src/io.o
src/io.c: In function ‘encoding_open’:
src/io.c:52:2: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
  strncpy(encoding->fromcode, fromcode, len);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/io.c:41:15: note: length computed here
  size_t len = strlen(fromcode);
               ^~~~~~~~~~~~~~~~
        CC  src/refdb.o
       GEN  src/builtin-config.c
        CC  src/builtin-config.o
        CC  src/request.o
        CC  src/line.o
        CC  src/keys.o
        CC  src/repo.o
        CC  src/options.o
        CC  src/draw.o
        CC  src/prompt.o
        CC  src/display.o
        CC  src/view.o
        CC  src/search.o
        CC  src/parse.o
src/parse.c: In function ‘get_path’:
src/parse.c:265:3: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
   strncpy(entry->path, path, strlen(path));
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        CC  src/watch.o
        CC  src/pager.o
        CC  src/log.o
        CC  src/reflog.o
        CC  src/diff.o
        CC  src/help.o
        CC  src/tree.o
src/tree.c: In function ‘tree_entry’:
src/tree.c:132:2: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
  strncpy(entry->name, path, strlen(path));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        CC  src/blob.o
        CC  src/blame.o
        CC  src/refs.o
src/refs.c: In function ‘refs_open’:
src/refs.c:210:3: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
   strncpy(ref->name, name, name_length);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/refs.c:204:21: note: length computed here
   int name_length = strlen(name);
                     ^~~~~~~~~~~~
        CC  src/status.o
        CC  src/stage.o
        CC  src/main.o
        CC  src/stash.o
        CC  src/grep.o
        CC  src/ui.o
        CC  src/apps.o
        CC  src/graph.o
        CC  src/graph-v1.o
        CC  src/graph-v2.o
        CC  compat/hashtab.o
        CC  compat/utf8proc.o
      LINK  src/tig
        CC  test/tools/test-graph.o
      LINK  test/tools/test-graph
        CC  tools/doc-gen.o
      LINK  tools/doc-gen

@koutcher
Copy link
Collaborator

For all these, the problem is rather on GCC side: Bug 88059, so nothing to worry about.

@krobelus
Copy link
Contributor

Yeah, these are not wrong but strncpy with an argument that is just strlen() can be replaced with strcpy most of the time.

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

No branches or pull requests

3 participants