[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: where the hell is itoa()?
- To: Ariel Biener <ariel(at-nospam)fireball.tau.ac.il>
- Subject: Re: where the hell is itoa()?
- From: mulix <mulix(at-nospam)actcom.co.il>
- Date: Sat, 14 Jul 2001 23:18:59 +0300 (IDT)
- Cc: Shaul Karl <shaulka(at-nospam)bezeqint.net>, b g <bgbg(at-nospam)md.huji.ac.il>, Linux-IL Mailing List <linux-il(at-nospam)linux.org.il>
- Delivered-To: linux.org.il-linux-il@linux.org.il
- In-Reply-To: <Pine.LNX.4.21_heb2.09.0107142251530.19191-100000@fireball.tau.ac.il>
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
On Sat, 14 Jul 2001, Ariel Biener wrote:
> #include <stdio.h>
> #include <stdlib.h>
>
> int main()
> {
>
> char *mychar;
> int a=99999; /* Just some random number */
>
> mychar=(char *)calloc(1, sizeof(int));
callock (and all other malloc related functions) can fail and return
NULL.
> sprintf(mychar, "%d%c", a, '\0');
you just overflowed your stack by one byte. snprintf is your friend.
> }
>
>
> This may be broken, but the idea is that standard C doesn't have itoa().
>
> --Ariel
--
mulix
http://www.advogato.com/person/mulix
linux/reboot.h: #define LINUX_REBOOT_MAGIC1 0xfee1dead
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il