¾µä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
Ïà¹ØÎÊ´ð£º
13¸öÈËΧ³ÉһȦ£¬´ÓµÚÒ»¸öÈË¿ªÊ¼Ë³Ðò±¨ºÅ1£¬2£¬3¡£·²±¨µ½3ÕßÍ˳öȦ×Ó£¬ÕÒ³ö×îºóÁôÔÚȦ×ÓÖеÄÈËÔÀ´µÄÐòºÅ
½á¹ûÓ¦¸ÃÊÇ13 ¿ÉÎҵijÌÐòµÄ½á¹ûÊÇ11 Ï£ÍûºÃÐÄÈ˰ï¸ÄÒ»ÏÂ
#include <stdio.h>
#include < ......
ÔÚueÖдÓÔ¶³ÌunixÓöþ½øÖÆ·½Ê½ÏÂÔØcÎļþµ½±¾µØ£¬ÐÞ¸ÄÖ®ºóÓöþ½øÖÆ·½Ê½ÉÏ´«µ½unixÖУ¬ÔÙÓÃvi´ò¿ª¸ÃÎļþ£¬Ã¿ÐкóÃæ¾Í»áÓÐÒ»¸ö^MµÄ»»Ðзû£¬Èç¹û²ÉÓÃascii·½Ê½ÏÂÔØ£¬¶þ½øÖÆ·½Ê½ÉÏ´«µÄ»°¾ÍûÓÐ^M£¬ÄÇÇëÎÊÕâÑù»á¶Ô³ÌÐòÎļþ ......
ÄãÃÇÏÖÔÚ»¹ÔÚÓÃCÂð£¿CÓÐǰ;Âð£¿
Ò»¶¨£¬²¢ÓÀÔ¶¼á³Ö
ÒýÓÃ
Ò»¶¨£¬²¢ÓÀÔ¶¼á³Ö
¶¥
ÓÐÓá£
Â¥Ö÷ºÎ³ö´ËÑÔ
Â¥Ö÷À´c°æÎÊÕâ¸öÎÊÌâÊÇÌß¹ÝÓÃÒâÂð¹þ¹þ
Ô½À´Ô½ÀäÊǿ϶¨µÄ£¬ÍêÈ«ÌÔ̵¹Ò²Ã»ÄÇôÈÝÒ×
c ......
´ó¼ÒºÃ£¡ÎÒÊÇһλC°®ºÃÕߣ¬Ïò´ó¼ÒÇë½ÌÏ£¬C³ÌÐòÔ±¿ÉºÃÕÒ¹¤×÷£¿¹«Ë¾ÓÃC¸ÉЩʲô£¿
ÎÞËùνºÃ²»ºÃÕÒ¹¤×÷£¬Ò»°ãͨÐÅ¡¢ÏµÍ³¡¢Ç¶Èëʽ¡¢Ó²¼þ·½ÃæÓõĶ࣬¶øÇÒÓÉÓÚCµÄµ×²ãÌØÐÔ£¬Ñ§»áºóÔÚѧÆäËûµÄ»á±È½ÏÈÝÒ×
²»¹ÜÓÃʲôÓï ......
09½ì¼ÆËã»úרҵ±¾¿ÆÉú£¬¸Õ²Î¼Ó¹¤×÷²»¾Ã£¬·¢ÏÖ×Ô¼º¶®µÃ¶«Î÷ÕæÊÇÌ«ÉÙÁË£¬ÏÖÔÚ´ÓÊÂǶÈëʽ¿ª·¢£¬±ØÈ»ÒªÑ§Ï°linux ºÍc/c++
c£«£«Õâ¶Îʱ¼äѧµÄÒ²ËãÂíÂí»¢»¢£¬±¾È˼ƻ®½ÓÏÂÀ´ÏÈÖÆ¶¨Ò»¸ö±È½ÏºÏÀíµÄѧϰ¼Æ»®£¬Ï£Íû¸÷λǰ± ......