Index: wp-includes/feed-atom-comments.php
===================================================================
--- wp-includes/feed-atom-comments.php	(revision 22353)
+++ wp-includes/feed-atom-comments.php	(working copy)
@@ -28,7 +28,7 @@
 
 <?php if ( is_singular() ) { ?>
 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php comments_link_feed(); ?>" />
-	<link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
+	<link rel="self" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?>" />
 	<id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>
 <?php } elseif(is_search()) { ?>
 	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" />
Index: wp-includes/feed-atom.php
===================================================================
--- wp-includes/feed-atom.php	(revision 22353)
+++ wp-includes/feed-atom.php	(working copy)
@@ -48,7 +48,7 @@
 <?php atom_enclosure(); ?>
 <?php do_action('atom_entry'); ?>
 		<link rel="replies" type="<?php bloginfo_rss('html_type'); ?>" href="<?php the_permalink_rss() ?>#comments" thr:count="<?php echo get_comments_number()?>"/>
-		<link rel="replies" type="application/atom+xml" href="<?php echo get_post_comments_feed_link(0,'atom') ?>" thr:count="<?php echo get_comments_number()?>"/>
+		<link rel="replies" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link(0, 'atom') ); ?>" thr:count="<?php echo get_comments_number()?>"/>
 		<thr:total><?php echo get_comments_number()?></thr:total>
 	</entry>
 	<?php endwhile ; ?>
Index: wp-includes/link-template.php
===================================================================
--- wp-includes/link-template.php	(revision 22353)
+++ wp-includes/link-template.php	(working copy)
@@ -484,9 +484,9 @@
 	} else {
 		$type = get_post_field('post_type', $post_id);
 		if ( 'page' == $type )
-			$url = home_url("?feed=$feed&amp;page_id=$post_id");
+			$url = add_query_arg( array( 'feed' => $feed, 'page_id' => $post_id ), home_url( '/' ) );
 		else
-			$url = home_url("?feed=$feed&amp;p=$post_id");
+			$url = add_query_arg( array( 'feed' => $feed, 'p' => $post_id ), home_url( '/' ) );
 	}
 
 	return apply_filters('post_comments_feed_link', $url);
