Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 6256)
+++ wp-includes/functions.php	(working copy)
@@ -337,6 +337,8 @@
 	wp_protect_special_option( $name );
 	$safe_name = $wpdb->escape( $name );
 
+	$value = sanitize_option( $name, $value );
+
 	// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
 	$notoptions = wp_cache_get( 'notoptions', 'options' );
 	if ( !is_array( $notoptions ) || !isset( $notoptions[$name] ) )
@@ -363,6 +365,7 @@
 
 	$wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES (%s, %s, %s)", $name, $value, $autoload ) );
 
+	do_action( "add_option_$name", $value );
 	return;
 }
 

