Re: [dev] [sic]: patches for string handling

2009-09-23 Thread Mark Edgar
On Wed, Sep 23, 2009 at 3:27 PM, Anselm R Garbe wrote: > 2009/9/22 Mark Edgar : >> * Use strcmp() instead of strncmp() where appropriate > > Applied. You missed one of these because it was mixed in with the startswith() change (patch attached). >> I have more changes, including getting rid of ca

Re: [dev] [sic]: patches for string handling

2009-09-23 Thread Kris Maglione
On Wed, Sep 23, 2009 at 03:56:55PM +0100, Anselm R Garbe wrote: Well you are right, I was assuming the sic.c context where all buffers are static and now used in a way that the last byte is always emergency terminator. Well, that's true, but I don't like making that kind of assumption. Someone

Re: [dev] [sic]: patches for string handling

2009-09-23 Thread Anselm R Garbe
2009/9/23 Kris Maglione : > On Wed, Sep 23, 2009 at 02:41:23PM +0100, Anselm R Garbe wrote: >> 2009/9/23 Kris Maglione : >>> >>> On Wed, Sep 23, 2009 at 12:53:35AM +0200, Mark Edgar wrote: * Fix buffer overrun when using strncpy() >>> >>> It's really sad to see code using strncpy. >> >> W

Re: [dev] [sic]: patches for string handling

2009-09-23 Thread Kris Maglione
On Wed, Sep 23, 2009 at 02:41:23PM +0100, Anselm R Garbe wrote: Hi, 2009/9/23 Kris Maglione : On Wed, Sep 23, 2009 at 12:53:35AM +0200, Mark Edgar wrote: * Fix buffer overrun when using strncpy() It's really sad to see code using strncpy. Well strncpy has performance issues on large buffe

Re: [dev] [sic]: patches for string handling

2009-09-23 Thread Anselm R Garbe
Hi, 2009/9/23 Kris Maglione : > On Wed, Sep 23, 2009 at 12:53:35AM +0200, Mark Edgar wrote: >> >> * Fix buffer overrun when using strncpy() > > It's really sad to see code using strncpy. Well strncpy has performance issues on large buffers since it pads the remainder with null bytes. I agree that

Re: [dev] [sic]: patches for string handling

2009-09-23 Thread Anselm R Garbe
2009/9/22 Mark Edgar : > Here's a summary of the changes in this patch: > > * Fix buffer overrun when using strncpy() Applied. > * Use startswith() macro instead strncmp() Not applied. > * Use strcmp() instead of strncmp() where appropriate Applied. > * Use const char * where appropriate Not

Re: [dev] [sic]: patches for string handling

2009-09-22 Thread Kris Maglione
On Wed, Sep 23, 2009 at 12:53:35AM +0200, Mark Edgar wrote: * Fix buffer overrun when using strncpy() It's really sad to see code using strncpy. * Use startswith() macro instead strncmp() Macros don't go over so well around here, but I'm in favor of that one (even if as a utility function

[dev] [sic]: patches for string handling

2009-09-22 Thread Mark Edgar
Here's a summary of the changes in this patch: * Fix buffer overrun when using strncpy() * Use startswith() macro instead strncmp() * Use strcmp() instead of strncmp() where appropriate * Use const char * where appropriate * Use size_t instead of unsigned int in readl(). The startswith() macro is