|
From: <ca...@kr...> - 2003-04-25 20:54:09
|
hi Ioannis,
>> > -stdin gets cleared
>> > how can i do that?
>>
>> fflush(stdin);
> Which is not safe. getchar(), fgets(), etc, should be used instead,
and why is that?
I am very interested in code security issues but at least i want to
understand instead of obey them. so what exactly is considered
'unsafe'?
what I need is a secure way to read as much as there is from stdin
undtil '\n' into a char* buffer. I want that buffer to match the
needed length (I don't know how to do that, since I don't know the
exact needed length until i read it from stdin...) and I need to avoid
buffer overflows (of course).
I thought scanf() is a good way, since it reads only a specified
number of characters right? (ok, this is just a workaround, I guess..)
I don't think this is a unique problem so there must be a known way to
solve it, is there?
gruss
/Christian mailto:ca...@kr...
---
I propose that the following character sequence for joke markers:
:-)
19-Sep-82 11:44 Scott E Fahlman
|