![]() |
|
|||||||
| Programming C, bash, Python, Perl, PHP, Java, you name it. |
![]() |
|
|
Thread Tools | Display Modes |
|
|||
|
Hello,
I have installed OpenBSD 4.9 (on a Dell Optiplex) to update the hardware for an application written in FORTRAN. I am using the GNU FORTRAN compiler from the packages collection. (g95-4.2.4p5v0.tgz ). Compiling produces warnings about misuse of strcpy(), sprintf() and strcat(). /usr/local/.../libgfortran.so.2.0: warning: strcpy() is almost always misused, please use strlcpy() and similar for sprintf() and snprintf(), and strcat() and strlcat() I assume that these warnings come from issues within the FORTRAN compiler, and hence cannot be fixed by changing the FORTRAN code. Is there a way to stop these warnings from coming up, as they are annoying the owner of the FORTRAN application. Thank-you, Michael Hill |
|
|||
|
The OpenBSD developers created strlcpy(3) as a safer version of strcpy(3). Unfortunately for some reason most of the Linux/GNU community does not accept these safer versions and stick to the old ones.
You mentioned the warnings only appear during compilation, so it is only a one time thing
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump Last edited by J65nko; 23rd August 2011 at 09:08 AM. |
|
||||
|
The GNU Fortran compiler depends upon the C library in OpenBSD's base, which produces those warning messages when strcpy(3) and the other insecure library functions are called during compilation.
If your customer does not want to see these messages, there are three options, as I see it. 1) port their application to another language, 2) use another OS, 3) customize the C library to eliminate the messages. AFAIK, there is no other Fortran compiler for OpenBSD.
__________________
OpenBSD LiveCDs/LiveDVDs |
|
|||
|
To be more specific, the warning is emitted by the GNU linker, it is used by OpenBSD to warn when deprecated or unsafe functions/symbols are referenced by programs.
The follow section of code from the C library.. lib/libc/string/strcpy.c. Code:
#if defined(APIWARN)
__warn_references(strcpy,
"warning: strcpy() is almost always misused, please use strlcpy()");
#endif
Code:
#if defined(APIWARN)
__asm__(".section .gnu.warning." __STRING(strcpy) " ; .ascii \"" warning: strcpy() is almost always misused, please use strlcpy() "\" ; .text");
#endif
|
|
|||
|
Thank-you for the clarification. I will let him know that it is not going to cause him any problems with his application.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| OpenBSD/pf without compiler HOWTO update? | zazen | OpenBSD Installation and Upgrading | 6 | 26th June 2011 06:47 AM |
| BSD licensed C, C++ and Fortran compiler released. | BSDfan666 | News | 5 | 14th June 2011 04:03 PM |
| Build Process Warnings | IronForge | OpenBSD Installation and Upgrading | 9 | 22nd January 2010 10:21 AM |
| pkg_chk c++ compiler not available | fenrisW0lf | NetBSD Package System (pkgsrc) | 15 | 30th June 2008 10:48 AM |
| pcc compiler question | ChineseBroccoli | FreeBSD General | 1 | 11th June 2008 11:29 PM |