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

strncat bounds warnings with GCC8 #69

Closed
cemremengu opened this issue Aug 4, 2018 · 3 comments
Closed

strncat bounds warnings with GCC8 #69

cemremengu opened this issue Aug 4, 2018 · 3 comments
Assignees
Labels

Comments

@cemremengu
Copy link

cemremengu commented Aug 4, 2018

Building ODPI-C version 2.4 on Windows 10 with gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0, I am getting these warnings after the build. Looks like there are no problems with the build overall though.

In file included from go\src\github.com\go-goracle\goracle\odpi\embed/dpi.c:37,
                 from go\src\github.com\go-goracle\goracle\drv.go:48:
C:/Users/cemre.mengu/go/src/github.com/go-goracle/goracle/odpi/src/dpiOci.c: In function 'dpiOci__findAndCheckDllArchitecture':
C:/Users/cemre.mengu/go/src/github.com/go-goracle/goracle/odpi/src/dpiOci.c:1429:9: warning: 'strncat' specified bound 261 equals destination size [-Wstringop-overflow=]
         strncat(fullName, "\\", sizeof(fullName));
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'dpiOci__findAndCheckDllArchitecture.constprop',
    inlined from 'dpiOci__getLoadErrorOnWindows.constprop' at C:/Users/cemre.mengu/go/src/github.com/go-goracle/goracle/odpi/src/dpiOci.c:1483:13,
    inlined from 'dpiOci__loadLib' at C:/Users/cemre.mengu/go/src/github.com/go-goracle/goracle/odpi/src/dpiOci.c:1549:13: C:/Users/cemre.mengu/go/src/github.com/go-goracle/goracle/odpi/src/dpiOci.c:1421:13: warning: 'strncat' specified bound 261 equals destination size [-Wstringop-overflow=]
             strncat(fullName, dllName, sizeof(fullName));
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/cemre.mengu/go/src/github.com/go-goracle/goracle/odpi/src/dpiOci.c:1430:9: warning: 'strncat' specified bound 261 equals destination size [-Wstringop-overflow=]
         strncat(fullName, dllName, sizeof(fullName));
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@cemremengu cemremengu changed the title Build warnings with GCC8 strncat bounds warning warnings with GCC8 Aug 4, 2018
@cemremengu cemremengu changed the title strncat bounds warning warnings with GCC8 strncat bounds warnings with GCC8 Aug 4, 2018
@cjbj cjbj added the bug label Aug 4, 2018
@cjbj
Copy link
Member

cjbj commented Aug 4, 2018

Off by one: "The strncat() function appends not more than n characters from s2, and then adds a terminating `\0'."

anthony-tuininga added a commit that referenced this issue Aug 6, 2018
@anthony-tuininga
Copy link
Member

@cemremengu, I just pushed a commit that should eliminate these warnings. Let me know if that is indeed the case. The only time you would have run into problems is when you were at exactly the maximum length -- very unlikely, but still worth fixing! Thanks for bringing it to our attention.

anthony-tuininga added a commit that referenced this issue Aug 7, 2018
…ng string

so make sure that has been addressed as well
(#69).
@cemremengu
Copy link
Author

Yes, compiling goracle with the recent master no longer produces these warnings. Thanks for the quick fix! Feel free to close the issue whenever you like.

@cjbj cjbj closed this as completed Aug 8, 2018
anthony-tuininga added a commit to oracle/python-cx_Oracle that referenced this issue Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants