Click here to Skip to main content
15,900,400 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CView: Change background color Pin
TuPacMansur7-Jul-10 13:27
TuPacMansur7-Jul-10 13:27 
GeneralUpsized database 100x slower in SQLServer Pin
mbaker17-Jul-05 21:46
mbaker17-Jul-05 21:46 
GeneralRe: Upsized database 100x slower in SQLServer Pin
Blake V. Miller8-Jul-05 16:58
Blake V. Miller8-Jul-05 16:58 
GeneralRe: Upsized database 100x slower in SQLServer Pin
Anonymous8-Jul-05 23:12
Anonymous8-Jul-05 23:12 
GeneralRe: Upsized database 100x slower in SQLServer Pin
Blake V. Miller12-Jul-05 17:14
Blake V. Miller12-Jul-05 17:14 
Questionwhich of these is the handle to my windowless app? Pin
awah7-Jul-05 21:45
awah7-Jul-05 21:45 
AnswerRe: which of these is the handle to my windowless app? Pin
khan++7-Jul-05 23:51
khan++7-Jul-05 23:51 
Generalproblem : strtok,strcpy,crashes when garbage strings are handled Pin
awah7-Jul-05 21:37
awah7-Jul-05 21:37 
strtok,strcpy,crashes when garbage strings are handled

this is especially so in winsock applications
in my application, i expect " value1^value2^value^&############"
and use strtok to extract value 1,2 and 3
and "&" indicates that there are no more values to be collected

where #### = garbaage
others can send a garbage long string like
"##################################"

and my application would crash

is there anyway to tell strtok/strcpy to handle this?

will a check on strlen help?

more info on my function

struct broken_msg<br />
{<br />
	void break_msg(char* full_msg)<br />
	{<br />
		char seps[] = "^";<br />
		char *token;<br />
		token = strtok( full_msg, seps ); <== CRASHES HERE<br />
		if(strlen(token) < 150)<br />
		{<br />
			strcpy(parm0,token);<br />
		}<br />
	<br />
		if(  stricmp("&" ,token )   )<br />
		{<br />
			token = strtok( NULL, seps );<br />
			if(strlen(token) < 150)<br />
			{<br />
				strcpy(parm1,token);<br />
			}<br />
		}<br />
		if(  stricmp("&" ,token )   )<br />
		{<br />
			token = strtok( NULL, seps );<br />
			if(strlen(token) < 150)<br />
			{<br />
				strcpy(parm2,token);<br />
			}<br />
<br />
		}<br />
		if(  stricmp("&" ,token )   )<br />
		{<br />
			token = strtok( NULL, seps ); <br />
			if(strlen(token) < 150)<br />
			{<br />
				strcpy(parm3,token);<br />
			}<br />
<br />
		}<br />
	}<br />
<br />
<br />
	char parm0[150];<br />
	char parm1[150];<br />
	char parm2[150];<br />
	char parm3[150];<br />
};

GeneralRe: problem : strtok,strcpy,crashes when garbage strings are handled Pin
khan++7-Jul-05 23:47
khan++7-Jul-05 23:47 
GeneralRe: problem : strtok,strcpy,crashes when garbage strings are handled Pin
David Crow8-Jul-05 3:52
David Crow8-Jul-05 3:52 
GeneralRe: problem : strtok,strcpy,crashes when garbage strings are handled Pin
John R. Shaw8-Jul-05 9:32
John R. Shaw8-Jul-05 9:32 
Generalmmx help, Privileged instruction exception. Pin
Member 34198917-Jul-05 21:35
Member 34198917-Jul-05 21:35 
GeneralRe: mmx help, Privileged instruction exception. Pin
Member 34198917-Jul-05 22:52
Member 34198917-Jul-05 22:52 
QuestionIs it possible to replace tab buttons in the tab control by a bitmap? Pin
Asha Udupa7-Jul-05 20:48
Asha Udupa7-Jul-05 20:48 
AnswerRe: Is it possible to replace tab buttons in the tab control by a bitmap? Pin
ThatsAlok7-Jul-05 21:38
ThatsAlok7-Jul-05 21:38 
QuestionProblem about Drag in TreeCtrl? Pin
sharkmouse7-Jul-05 19:44
sharkmouse7-Jul-05 19:44 
AnswerRe: Problem about Drag in TreeCtrl? Pin
Nilesh K.7-Jul-05 20:15
Nilesh K.7-Jul-05 20:15 
GeneralUNICODE Pin
John R. Shaw7-Jul-05 17:17
John R. Shaw7-Jul-05 17:17 
GeneralRe: UNICODE Pin
Jose Lamas Rios7-Jul-05 18:09
Jose Lamas Rios7-Jul-05 18:09 
GeneralRe: UNICODE Pin
John R. Shaw8-Jul-05 8:47
John R. Shaw8-Jul-05 8:47 
GeneralRe: UNICODE Pin
Jose Lamas Rios8-Jul-05 10:10
Jose Lamas Rios8-Jul-05 10:10 
GeneralRe: UNICODE Pin
John R. Shaw8-Jul-05 10:55
John R. Shaw8-Jul-05 10:55 
GeneralRe: UNICODE Pin
toxcct7-Jul-05 20:21
toxcct7-Jul-05 20:21 
GeneralRe: UNICODE Pin
John R. Shaw8-Jul-05 7:09
John R. Shaw8-Jul-05 7:09 
GeneralRe: UNICODE Pin
Bob Stanneveld7-Jul-05 22:03
Bob Stanneveld7-Jul-05 22:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.