On 9/14/06, G TT <[EMAIL PROTECTED]> wrote:
> Vi` "white spaces" ddu+o+.c xem nhu+ "string terminator", ne^n xem ma~:
>
> #inclue <stdio.h>
> int main()
> {
> char str[80];
> printf("Enter some words (or 'ctrl-c' to break): ");
> scanf("%s", str);  <====== buffer length unchecked HERE

It is a very *stupid* idea to use scanf() to get input!
fgets() is certainly a better choice in this case.
RTFM!


Cheers,
H

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users

Trả lời cho