|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: Secure coding in C (was Re: Administrivia #4883)
Subject: Re: Secure coding in C (was Re: Administrivia #4883)
From: Blue Boar (BlueBoar
THIEVCO.COM)
Date: Sun Jan 16 2000 - 00:03:28 CST
- Next message: Liviu Daia: "Re: Secure coding in C (was Re: Administrivia #4883)"
- Previous message: kay: "Re: Secure coding in C (was Re: Administrivia #4883)"
- In reply to: Bennett Todd: "Secure coding in C (was Re: Administrivia #4883)"
- Next in thread: Brian Kifiak: "Re: Secure coding in C (was Re: Administrivia #4883)"
- Next in thread: Ken Williams: "Re: Administrivia #4883"
- Reply: Blue Boar: "Re: Secure coding in C (was Re: Administrivia #4883)"
- Reply: Brian Kifiak: "Re: Secure coding in C (was Re: Administrivia #4883)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bennett Todd wrote:
>
> char *a = something();
> char *b = something_else();
> int len = strlen(a) + strlen(b);
> char *c = malloc(len + 1) || die("malloc");
> (void) strcat(strcpy(c, a), b);
If you have any reasonable idea what a maximum size for a or b might
be, then this could be better. As it is, if I'm trying to DoS you
but sending huge strings, you've made it that much easier by doubling
the amount of RAM needed. Since you're limiting yourself to MAXINT
anyway, you should check that against the sizes of a and b before
you malloc.
OTOH, since you mentioned this is a mail app... if those variables
represent the body of the message, you have no real choice.
BB
- Next message: Liviu Daia: "Re: Secure coding in C (was Re: Administrivia #4883)"
- Previous message: kay: "Re: Secure coding in C (was Re: Administrivia #4883)"
- In reply to: Bennett Todd: "Secure coding in C (was Re: Administrivia #4883)"
- Next in thread: Brian Kifiak: "Re: Secure coding in C (was Re: Administrivia #4883)"
- Next in thread: Ken Williams: "Re: Administrivia #4883"
- Reply: Blue Boar: "Re: Secure coding in C (was Re: Administrivia #4883)"
- Reply: Brian Kifiak: "Re: Secure coding in C (was Re: Administrivia #4883)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This archive was generated by hypermail 2b27 : Sun Jan 16 2000 - 00:11:44 CST