<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.dotnetzone.gr:443/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code Security</title><link>https://www.dotnetzone.gr:443/cs/forums/139/ShowForum.aspx</link><description>Περιοχή που συζητάμε για το το code security - ένα θέμα που πρέπει να απασχολεί κάθε προγραμματιστή.</description><dc:language>el</dc:language><generator>CommunityServer 2.1 SP3 (Build: 20423.1)</generator><item><title>Απ: Χρήση format parameter %n σε printf στην C++ (VS2008)</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/57736.aspx</link><pubDate>Wed, 17 Mar 2010 22:34:17 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:57736</guid><dc:creator>Thiseas</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/57736.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=139&amp;PostID=57736</wfw:commentRss><description>&lt;P&gt;Ops.... thnx a lot mate!&lt;/P&gt;
&lt;P&gt;Thnx a lot.&lt;BR&gt;Έψαχνα ακριβώς αυτό: &lt;A href="http://msdn.microsoft.com/en-us/library/ms175782.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms175782.aspx&lt;/A&gt;&lt;/P&gt;</description></item><item><title>Απ: Χρήση format parameter %n σε printf στην C++ (VS2008)</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/57716.aspx</link><pubDate>Wed, 17 Mar 2010 08:09:35 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:57716</guid><dc:creator>darklynx</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/57716.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=139&amp;PostID=57716</wfw:commentRss><description>&lt;P&gt;Το documentation αναφέρει επί του θέματος ότι είναι απενεργοποιημένος ο εν λόγω field character και πρέπει να την ενεργοποιήσεις ο ίδιος για να χρησιμοποιήσεις την %n.Ορίστε πως θα δουλέψει το παράδειγμά σου:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:black;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;#define&lt;/SPAN&gt; PRINTF_COUNT_ENABLE 1
&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;#define&lt;/SPAN&gt; PRINTF_COUNT_DISABLE 0

&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;int&lt;/SPAN&gt; main(&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;int&lt;/SPAN&gt; argc, &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;char&lt;/SPAN&gt;* argv[])
{

	_set_printf_count_output(PRINTF_COUNT_ENABLE);

	&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;int&lt;/SPAN&gt; value &lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:red;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;=&lt;/SPAN&gt; 0;
	printf(&lt;SPAN style="BACKGROUND-COLOR:#e4e4e4;FONT-FAMILY:Courier New;COLOR:#666666;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;"1st 0: %d\n"&lt;/SPAN&gt;, value);
	printf(&lt;SPAN style="BACKGROUND-COLOR:#e4e4e4;FONT-FAMILY:Courier New;COLOR:#666666;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;"AAAA%n\t"&lt;/SPAN&gt;, &amp;amp;value);
	printf(&lt;SPAN style="BACKGROUND-COLOR:#e4e4e4;FONT-FAMILY:Courier New;COLOR:#666666;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;"2nd: %d\n"&lt;/SPAN&gt;, value);
	printf(&lt;SPAN style="BACKGROUND-COLOR:#e4e4e4;FONT-FAMILY:Courier New;COLOR:#666666;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;"AAAAAA%n\t"&lt;/SPAN&gt;, &amp;amp;value);
	printf(&lt;SPAN style="BACKGROUND-COLOR:#e4e4e4;FONT-FAMILY:Courier New;COLOR:#666666;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;"3rd: %d\n"&lt;/SPAN&gt;, value);

	system(&lt;SPAN style="BACKGROUND-COLOR:#e4e4e4;FONT-FAMILY:Courier New;COLOR:#666666;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;"pause"&lt;/SPAN&gt;);


	&lt;SPAN style="BACKGROUND-COLOR:transparent;FONT-FAMILY:Courier New;COLOR:blue;FONT-SIZE:11px;FONT-WEIGHT:normal;"&gt;return&lt;/SPAN&gt; 0;
}&lt;/SPAN&gt;&lt;/PRE&gt;</description></item><item><title>Απ: Χρήση format parameter %n σε printf στην C++ (VS2008)</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/57711.aspx</link><pubDate>Wed, 17 Mar 2010 06:57:09 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:57711</guid><dc:creator>Thiseas</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/57711.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=139&amp;PostID=57711</wfw:commentRss><description>Επειδή δεν βλέπω και πολύ μεγάλη συμμετοχή, παραθέτω και το πρόγραμμα σε C που έχω χρησιμοποιήσει (αυτό που τρέχει σε linux αλλά σκάει στο runtime σε Windows...) μήπως βοηθηθεί κάποιος φίλος περισσότερο...&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;span style="color:Black;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;#include &amp;lt;stdio.h&amp;gt;
&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;int&lt;/span&gt; main(&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;int&lt;/span&gt; argc, &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;char&lt;/span&gt; *argv[])
{
	&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;int&lt;/span&gt; value &lt;span style="color:Red;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; 0;
	printf(&lt;span style="font-family:Courier New;font-size:11px;font-weight:normal;"&gt;"1st 0: %d\n"&lt;/span&gt;, value);
	printf(&lt;span style="font-family:Courier New;font-size:11px;font-weight:normal;"&gt;"AAAA%n\t"&lt;/span&gt;, &amp;amp;value);
	printf(&lt;span style="font-family:Courier New;font-size:11px;font-weight:normal;"&gt;"2nd: %d\n"&lt;/span&gt;, value);
	printf(&lt;span style="font-family:Courier New;font-size:11px;font-weight:normal;"&gt;"AAAAAA%n\t"&lt;/span&gt;, &amp;amp;value);
	printf(&lt;span style="font-family:Courier New;font-size:11px;font-weight:normal;"&gt;"3rd: %d\n"&lt;/span&gt;, value);
	&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;return&lt;/span&gt; 0;
}&lt;/span&gt;&lt;/pre&gt;&lt;br&gt;Thnx&lt;br&gt;</description></item><item><title>Χρήση format parameter %n σε printf στην C++ (VS2008)</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/57686.aspx</link><pubDate>Tue, 16 Mar 2010 00:18:04 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:57686</guid><dc:creator>Thiseas</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/57686.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=139&amp;PostID=57686</wfw:commentRss><description>&lt;P&gt;Αναφέρεται από &lt;A href="http://weblogs.asp.net/george_v_reilly/archive/2007/02/06/printf-n.aspx"&gt;μερικούς&lt;/A&gt; οτι η παράμετρος %n της printf που γράφει σε συγκεκριμένη διεύθυνση μνήμης συγκεκγριμένες τιμές, έχει καταργηθεί από την Microsoft, αν και αναφέρεται μέσα στο &lt;A href="http://msdn.microsoft.com/en-us/library/hf4y5e3w.aspx"&gt;MSDN&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Πράγματι, κάνοντας χρήση της %n μέσα από προγράμματα C++ σε VS2005,2010 σε XP,Vista,7 το πρόγραμμα απλά κρασάρει στο runtime ενώ περνάει κανονικά compile. Ίδιο ακριβώς πρόγραμμα λειτουργεί μια χαρά σε linux περιβάλλον. Αυτο το λέω για να μην θεωρηθεί οτι γίνεται κακή χρήση της %n.&lt;/P&gt;&lt;P&gt;Από πλευράς security η παράμετρος %n έχει χρησιμοποιηθεί κατ' επανάληψη σε &lt;A href="http://en.wikipedia.org/wiki/Format_string_attack"&gt;Format String επιθέσεις&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Έχει χρησιμοποιήσει κανένας φίλος εδώ, &lt;STRONG&gt;&lt;U&gt;επιτυχώς&lt;/U&gt;&lt;/STRONG&gt; το %n σε printf, σε κάποιο από τα παραπάνω περιβάλλοντα (C++ σε VS2005,2010 σε XP,Vista,7)? &lt;BR&gt;Αν ναι, μήπως θα είχε την καλοσύνη να μας έδειχνε πώς ή αν έχει ακούσει οτι πράγματι έχει καταργηθεί?&lt;/P&gt;&lt;P&gt;&lt;BR&gt;&lt;/P&gt;&lt;P&gt;Thnx 4 your time! :)&lt;/P&gt;&lt;P&gt;&lt;BR&gt;&lt;/P&gt;</description></item></channel></rss>