¾µäC³ÌÐòÇó½â
Problem 1
Read Ken Thompson's article ...
char s[] = {
'\t',
'0',
'\n',
'}',
';",
'\n',
'\n',
'/',
'*',
'\n',
(213 lines deleted)
0
};
/* The string s is a
* representation of the body
* of this program from '0'
* to the end.
*/
main(){
int i;
printf("char\ts{ } = {\n");
for(i=0; s[i]; i++)
printf("\t%d,\n",s[i]);
printf("%s",s);
}
Compile and run this program. You will have to figure out what goes in the 213 deleted lines. If you want, you can leave the comment out of the string s and out of the program. Explain the output. By itself, this program does not pose any sort of security threat. Explain in your own words what this program has to do with Thompson's Trojan Horse attack.
û¿´¶®¡£
printf("%s",s); Ö´ÐÐÕâ¾äµÄʱºò£¬s[1]µÄ'0'Ϊʲôû´ò³öÀ´ÄØ£¿
up
ÕÒµ½ÄǸö'0'ÁË£¬¸Õ²Å¿´´íÐÐÁË¡£
²»¹ý»¹ÊÇû¿´Ã÷°×ľÂíÊÇÔõô»ØÊÂ
mark
ÕÒµ½ÔÎÄÁË£¬ÕâÊÇKen Thompson»ñµÃͼÁé½±µÄÑݽ²µÄÒ»²¿·Ö¡£
Õâ¶Î´úÂëÊÇÒ»¸öÀý×Ó£¬Ëü¿ÉÒÔ²úÉú¾ßÓÐ×ÔÎÒ¸´ÖÆÄÜÁ¦µÄ³ÌÐò¡£
²»¹ý¡¡»¹ÊÇû¿´¶®
Figure 1 shows a s
Ïà¹ØÎÊ´ð£º
C\C++ÈçºÎ¼ÆË㺯ÊýµÄµ¼Êý,±¾ÈËÐÂÊÖ£¬Ïëд¸ö³ÌÐò£¬µ«ÊDz»ÖªµÀÈçºÎÏÂÊÖ£¬»¹Íû¸ßÊÖÖ¸µãÒ»¶þ£¬Ð»¹ý¡£
Õâ¸ö¡¡
¸úº¯ÊýµÄ¾ßÌåÐÎʽÓйذɣ¬ÄѵÀÄãÏë±à³ö¸ö¡°ÍòÄÜ¡±µÄÇ󵼺¯Êý£¿
°³ÉÏѧʱÏë¹ý×Ô¶¯ÍƵ¼¹«Ê½£¬ºóÀ´ ......
ÄãÃÇÏÖÔÚ»¹ÔÚÓÃCÂð£¿CÓÐǰ;Âð£¿
Ò»¶¨£¬²¢ÓÀÔ¶¼á³Ö
ÒýÓÃ
Ò»¶¨£¬²¢ÓÀÔ¶¼á³Ö
¶¥
ÓÐÓá£
Â¥Ö÷ºÎ³ö´ËÑÔ
Â¥Ö÷À´c°æÎÊÕâ¸öÎÊÌâÊÇÌß¹ÝÓÃÒâÂð¹þ¹þ
Ô½À´Ô½ÀäÊǿ϶¨µÄ£¬ÍêÈ«ÌÔ̵¹Ò²Ã»ÄÇôÈÝÒ×
c ......
´ó¼ÒºÃ£¡ÎÒÊÇһλC°®ºÃÕߣ¬Ïò´ó¼ÒÇë½ÌÏ£¬C³ÌÐòÔ±¿ÉºÃÕÒ¹¤×÷£¿¹«Ë¾ÓÃC¸ÉЩʲô£¿
ÎÞËùνºÃ²»ºÃÕÒ¹¤×÷£¬Ò»°ãͨÐÅ¡¢ÏµÍ³¡¢Ç¶Èëʽ¡¢Ó²¼þ·½ÃæÓõĶ࣬¶øÇÒÓÉÓÚCµÄµ×²ãÌØÐÔ£¬Ñ§»áºóÔÚѧÆäËûµÄ»á±È½ÏÈÝÒ×
²»¹ÜÓÃʲôÓï ......
ÒªÇó£º ¼ÆËã»ú»òÕßͨÐÅרҵ
ÊìϤCÓïÑÔ£¬ÓÐǶÈëʽ¿ª·¢¾Ñé
1-2Ä깤×÷¾Ñ飨Ӧ½ìÉúÈç²àÖØÏµÍ³¡¢µ×²ãÒ²¿ÉÒÔ£©
&nbs ......
ÎÒCѧµÃ²»ÊǺܺã¬ÎÒÃÇÏÖÔÚÓÖ¿ªÊ¼Ñ§C++ÁË£¬ÎÒ¿ÉÒÔ²»¿ÉÒÔÌø¹ýCÖ±½ÓȥѧC++°¡£¿ÒÔºó¹¤×÷ÁËCºÜÖØÒªºÜ³£ÓÃÊÇô£¿
¿ÉÒÔ¡£
cºÍc++µÄ²î±ð¿ÉÒÔ˵ºÜ´ó£¬µ«ÊÇÔÚѧϰµÄ¹ý³ÌÖбȽÏÄÑÌå»áµ½¡£ÉÏѧµÄʱºò»¹ÊǶ໨ʱ¼äÔÚ»ù´¡ÉÏ£ ......