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

Don't export system related symbols like strlcat #927

Closed
2 tasks done
schwehr opened this issue Apr 18, 2018 · 5 comments · Fixed by #2906
Closed
2 tasks done

Don't export system related symbols like strlcat #927

schwehr opened this issue Apr 18, 2018 · 5 comments · Fixed by #2906
Assignees
Milestone

Comments

@schwehr
Copy link

schwehr commented Apr 18, 2018

I'm on a system where strlcat is not defined. netcdf then builds with strlcat and exports the symbol. Then a user creates a binary that links against another library that also doesn't see strlcat and also exports strlcat. The linker is then sad. Neither package should be exporting strlcat. I'm hacking around in my system by renaming strlcat to nc_strlcat.

Environment Information

netcdf 4.6.1 point release

Feel free to skip this if the issue is related to documentation, a feature request, or general discussion.

  • What platform are you using? (please provide specific distribution/version in summary)
    • [x ] Linux = Custom
  • 32 and/or 64 bit?
    • [x ] 64-bit
  • What build system are you using?
    • bazel
  • Can you provide a sample netCDF file or C code to recreate the issue?
    • No

Steps to reproduce the behavior

Link against something like unix file or https://virustotal.github.io/yara/

@DennisHeimbigner
Copy link
Collaborator

Good point. We can fix for netcdf-c by using a name such as "nc_strlcat" and
a macro #define strlcat nc_strlcat

@edwardhartnett
Copy link
Contributor

I believe this has been fixed and this issue can be closed.

@schwehr
Copy link
Author

schwehr commented Apr 28, 2022

Can you link to the commit where it was fixed?

@edwardhartnett
Copy link
Contributor

No! ;-) But I seem to recall that Dennis fixed all these at one point. Can you look in the current main branch and see?

@DennisHeimbigner
Copy link
Collaborator

I was just looking at this. The change I made was to try and replace
use of strncpy with strlcat.

The code for the last resort strlcat is in netcdf-c/libdispatch/dstrings.c
So we could rename it to, say, nc_strlcat, and then modify the strlcat
related ifdefs in include/ncconfigure.h.

But is this problem restricted to strlcat? are there other functions in dstrings.c
that need similar treatment.

@WardF WardF self-assigned this Apr 28, 2022
@WardF WardF added this to the 4.9.1 milestone Apr 28, 2022
@WardF WardF modified the milestones: 4.9.1, 4.9.2 Feb 13, 2023
@WardF WardF modified the milestones: 4.9.2, 4.9.3 May 16, 2023
weiznich added a commit to GiGainfosystems/netcdf-c that referenced this issue Apr 8, 2024
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 a pull request may close this issue.

4 participants