Hi!
> > Using sscanf() to fill string buffer is potentialy dangerous. You
> > could
> > either to use GNU extension to hardcode maximal buffer length into the
> > format string or to go trough the string while you find whitespace
> > (see
> > isspace()).
> I'm not sure how to changed it, could you give me more details about how to
> avoid
> Using sscanf(). and always I think Using sscanf() can solve this question.
Well, the problem with sscanf("%s", buf) is that the sscanf() don't know
how long is the buffer and that may lead to buffer overflow and strange
and unexpected behavior.
Generally there are two ways how to fix it. Either use GNU extension to
hardcode the maximal length of the buffer into the string, eg.
sscanf("%64s, buf); would say sscanf to use at most 64 bytes of the
buffer. Or go trough the string with while cycle till you find first
occurence of whitespace.
--
Cyril Hrubis
[email protected]
------------------------------------------------------------------------------
Why Cloud-Based Security and Archiving Make Sense
Osterman Research conducted this study that outlines how and why cloud
computing security and archiving is rapidly being adopted across the IT
space for its ease of implementation, lower cost, and increased
reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list