OSDN Git Service

プロフィール更新時に <, > などの記号をエスケープしていない問題を修正 (thx @cn!)
authorKimura Youichi <kim.upsilon@bucyou.net>
Sat, 6 Apr 2013 19:03:32 +0000 (04:03 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 6 Apr 2013 19:03:56 +0000 (04:03 +0900)
エスケープされていない <, > などの記号はTwitterAPI側で除去されるため、セキュリティ上の問題はない

OpenTween/Connection/HttpTwitter.cs
OpenTween/Resources/ChangeLog.txt
OpenTween/ShowUserInfo.cs
OpenTween/UserInfo.cs

index cd58505..fc3058c 100644 (file)
@@ -892,10 +892,10 @@ namespace OpenTween
         {
             Dictionary<string, string> param = new Dictionary<string, string>();
 
-            param.Add("name", name);
+            param.Add("name", WebUtility.HtmlEncode(name));
             param.Add("url", url);
-            param.Add("location", location);
-            param.Add("description", description);
+            param.Add("location", WebUtility.HtmlEncode(location));
+            param.Add("description", WebUtility.HtmlEncode(description));
             param.Add("include_entities", "true");
 
             return httpCon.GetContent(PostMethod,
index 309e5a5..41dd57a 100644 (file)
@@ -9,6 +9,7 @@
  * FIX: アカウント追加時の初回認証に失敗する問題を修正 (thx @polka_roco_!)
  * FIX: ツールバー上のAPIレートリミット表示が正しく動作しなくなった問題を修正
  * FIX: ツイタマなど一部のTwitterクライアントから投稿されたツイートの改行が正しく表示されない問題を修正 (thx @ohta8801, @kossetsu_inryo!)
+ * FIX: プロフィール編集画面で入力した <, > などの記号が保持されない問題を修正 (thx @cn!)
 
 ==== Ver 1.0.9-beta1(2013/02/08)
  * ベータ版です
index 3d5134a..6eb03ac 100644 (file)
@@ -35,6 +35,7 @@ using System.Windows.Forms;
 using System.Text.RegularExpressions;
 using System.Web;
 using System.IO;
+using System.Net;
 
 namespace OpenTween
 {
@@ -86,10 +87,10 @@ namespace OpenTween
             try
             {
                 _info.Id = user.Id;
-                _info.Name = user.Name.Trim();
+                _info.Name = WebUtility.HtmlDecode(user.Name).Trim();
                 _info.ScreenName = user.ScreenName;
-                _info.Location = user.Location;
-                _info.Description = user.Description;
+                _info.Location = WebUtility.HtmlDecode(user.Location);
+                _info.Description = WebUtility.HtmlDecode(user.Description);
                 _info.ImageUrl = new Uri(user.ProfileImageUrlHttps);
                 _info.Url = user.Url;
                 _info.Protect = user.Protected;
@@ -138,7 +139,7 @@ namespace OpenTween
         private string MakeDescriptionBrowserText(string data)
         {
             descriptionTxt = MyOwner.createDetailHtml(
-                                    MyOwner.TwitterInstance.CreateHtmlAnchor(data, atlist, null));
+                                    MyOwner.TwitterInstance.CreateHtmlAnchor(WebUtility.HtmlEncode(data), atlist, null));
             return descriptionTxt;
         }
 
index f37fd03..2871594 100644 (file)
@@ -25,6 +25,7 @@
 // Boston, MA 02110-1301, USA.
 
 using System;
+using System.Net;
 
 namespace OpenTween
 {
@@ -37,10 +38,10 @@ namespace OpenTween
         public UserInfo(TwitterDataModel.User user)
         {
             this.Id = user.Id;
-            this.Name = user.Name.Trim();
+            this.Name = WebUtility.HtmlDecode(user.Name).Trim();
             this.ScreenName = user.ScreenName;
-            this.Location = user.Location;
-            this.Description = user.Description;
+            this.Location = WebUtility.HtmlDecode(user.Location);
+            this.Description = WebUtility.HtmlDecode(user.Description);
             try
             {
                 this.ImageUrl = new Uri(user.ProfileImageUrlHttps);