buglwIP - A Lightweight TCP/IP stack - Bugs: bug #37156, [ppp-new] missing <stdlib.h>...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #37156: [ppp-new] missing <stdlib.h> + namespace conflict with some libc about strlcpy() and strlcat() utils.c functions

Submitted by:  hanhui <hanhui03>
Submitted on:  Tue 21 Aug 2012 11:26:55 AM UTC  
 
Category:  None Severity:  2 - Minor
Item Group:  Compiler Warning Status:  Fixed
Privacy:  Public Assigned to:  Sylvain Rochet <gradator>
Open/Closed:  Closed Planned Release:  None
lwIP version:  Other

( Jump to the original submission)

Tue 21 Aug 2012 06:32:07 PM UTC, comment #7: 

All exported (not static) utils.c functions renamed.

<stdlib.h> added to ppp_impl.h

Both bugs are fixed in ppp-new.

Sylvain Rochet <gradator>
Project MemberIn charge of this item.
Tue 21 Aug 2012 01:25:33 PM UTC, comment #6: 

> maybe we should just rename those functions.


That's OK for me, I just wanted to ensure lwIP can be compiled there without having to change the sources.

> Well, this should have been better reported into two bugs report, this is getting a bit confusing


Indeed. That's true for all "multi"-bug reports.

Simon Goldschmidt <goldsimon>
Project Administrator
Tue 21 Aug 2012 01:21:07 PM UTC, comment #5: 

Yup, you are right about strtol() / <stdlib.h>, it will be added to ppp_impl.h.

(Well, this should have been better reported into two bugs report, this is getting a bit confusing)

Sylvain Rochet <gradator>
Project MemberIn charge of this item.
Tue 21 Aug 2012 01:15:58 PM UTC, comment #4: 

strlcpy() and strlcat() are actually copied straight from PPPd, which doesn't seem to have been ported to OpenBSD or FreeBSD recently, which can explain why the conflict stay unnoticed until now.

We don't have a way to build a config.h with directives like HAVE_STRLCAT or HAVE_STRLCPY from a configure/bootstrap script so if we don't want to compile and link them twice, it needs adding two more configuration options from PPP.

strlcpy() and strlcat() from PPPd are I guess tiny enough to be compiled twice, they are actually small wrappers around strncpy() and strncat() so it doesn't cost much code to add them, maybe we should just rename those functions.

Sylvain Rochet <gradator>
Project MemberIn charge of this item.
Tue 21 Aug 2012 01:06:39 PM UTC, comment #3: 

Sorry,

Regarding 1: I'm wrong. I just want to say that chap_ms.c MUST add #include <stdlib.h>

In IEEE Std 1003.1, 2004 Edition, strtol() declared in stdlib.h

You can see it in
http://pubs.opengroup.org/onlinepubs/009696699/functions/strtol.html

hanhui <hanhui03>
Tue 21 Aug 2012 12:56:23 PM UTC, comment #2: 

Regarding 2: I'd suggest to either rename these functions or making compiling them conditionally (as hanhui suggests, which is probably the better idea since you don't link the function twice if you already have it from somewhere else). At least you couldn't compile ppp-new under *BSD like it is now, could you?

And even if nobody does that, it does not feel right to include "generic" libc functions in the lwIP code (even if they are non-standard).

Simon Goldschmidt <goldsimon>
Project Administrator
Tue 21 Aug 2012 12:32:50 PM UTC, comment #1: 

1: I don't see why it is necessary, chap_ms.c includes netif/ppp/ppp_impl.h which includes <string.h>, could you clarify about that ?

2: Again, you have to explain why is it necessary, maybe your libc already define strlcpy(), strlcat() ?  (they are OpenBSD/FreeBSD non standard safe versions of strncpy(), strncat() that can be added in some libc)

Sylvain Rochet <gradator>
Project MemberIn charge of this item.
Tue 21 Aug 2012 11:26:55 AM UTC, original submission:  

1: chap_ms.c MUST add #include <string.h>

2: utils.c add some config, that can enable or disable some function such as strlcpy() strlcat() ....

hanhui <hanhui03>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by gradator (Posted a comment)
  • -email is unavailable- added by hanhui03 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-08-21 gradator StatusIn Progress => Fixed
        Open/ClosedOpen => Closed
    2012-08-21 gradator StatusNeed Info => In Progress
        Summary[ppp-new] some suggest => [ppp-new] missing <stdlib.h> + namespace conflict with some libc about strlcpy() and strlcat() utils.c functions
    2012-08-21 gradator Severity3 - Normal => 2 - Minor
        StatusNone => Need Info
        Assigned toNone => gradator

    Back to the top


    Powered by Savane 3.5