% cat f.c
#include <stdio.h>

int main(void)
{
  printf("%d\n", sizeof("1234"));
  printf("%d\n", strlen("1234"));
  return 0;
}

% ./f    
5
4

So, yes, it does include the terminating nul. So, the patch needs to
change sizeof to strlent and add 1 character.

FWIW, the previous code which uses sizeof case is called a string
literal. The C preprocessor (#define) is at a different layer than the
C compiler.

JE

On Fri, Jun 06, 2003, Matt Pavlovich <[EMAIL PROTECTED]> wrote:
> When you #define a string, does it add a nul character?  If not, then
> the original code was missing a byte in the malloc.
> 
> Adding a +1 wouldn't hurt anything anyway.
> 
> On Fri, 2003-06-06 at 13:02, Johannes Erdfelt wrote:
> > And don't forget the termination null! :)
> > 
> > JE
> > 
> > On Fri, Jun 06, 2003, Matt Pavlovich <[EMAIL PROTECTED]> wrote:
> > > Yeah, I am a dumb ass.
> > > 
> > > On Thu, 2003-06-05 at 19:37, Johannes Erdfelt wrote:
> > > > On Thu, Jun 05, 2003, Matt Pavlovich <[EMAIL PROTECTED]> wrote:
> > > > > No brainer config option to allow users to modify the 'catch-all' address 
> > > > > for hosteddomains.  Also should work to allow just "@domain.com". (Not 
> > > > > tested).
> > > > > @@ -308,12 +313,12 @@
> > > > >                               lai.rwi=rwi;
> > > > >                               lai.found=0;
> > > > >  
> > > > > -                             alloc_buf=malloc(sizeof(DEFAULTNAME)
> > > > > +                             alloc_buf=malloc(sizeof(getenv("CATCHALLNAME"))
> > > > >                                                +strlen(atdomain));
> > > > 
> > > > You sure this shouldn't be strlen(getenv("CATCHALLNAME")) ?
> > > > 
> > > > JE
> > > > 
> > > 
> > > 
> > > 
> > > -------------------------------------------------------
> > > This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
> > > thread debugger on the planet. Designed with thread debugging features
> > > you've never dreamed of, try TotalView 6 free at www.etnus.com.
> > > _______________________________________________
> > > courier-users mailing list
> > > [EMAIL PROTECTED]
> > > Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
> thread debugger on the planet. Designed with thread debugging features
> you've never dreamed of, try TotalView 6 free at www.etnus.com.
> _______________________________________________
> courier-users mailing list
> [EMAIL PROTECTED]
> Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to