]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/smiley.pm
avoid potential infinite loop in smiley expansion
[ikiwiki.git] / IkiWiki / Plugin / smiley.pm
index 1697a37c1981d0520f1966a53cd647324fcb2ba8..0d77916d0d3d633e7656d79527cce12647089d47 100644 (file)
@@ -87,10 +87,10 @@ MATCH:      while (m{(?:^|(?<=\s|>))(\\?)$smiley_regexp(?:(?=\s|<)|$)}g) {
                }
                else {
                        # Replace the smiley with its expanded value.
-                       substr($_, $spos, length($smiley))=
-                               htmllink($params{page}, $params{destpage},
+                       my $link=htmllink($params{page}, $params{destpage},
                                         $smileys{$smiley}, linktext => $smiley);
-                       pos=$epos+1;
+                       substr($_, $spos, length($smiley))=$link;
+                       pos=$epos+length($link);
                }
        }