​Yahoo is taking a $350 million US hit on its previously announced $4.8 billion US sale to Verizon in a concession for security lapses that exposed personal information stored in more than 1 billion Yahoo user accounts.

The revised agreement, announced Tuesday, eases investor worries that Verizon Communications Inc. would demand a discount of at least $1 billion US or cancel the deal entirely.

The hacking bombshells, disclosed after the two companies agreed on a sale, represent the two biggest security breaches in internet history.

The breaches raised concerns that people might decrease their use of Yahoo email and other digital services that Verizon is buying. A smaller audience makes Yahoo's services less valuable because it reduces the opportunities to show ads — the main reason that Verizon struck the deal seven months ago.

Yahoo has maintained that its users have remained loyal, despite any mistrust that might have been caused by its lax security and the lengthy delay in discovering and disclosing the hacks. The separate attacks occurred in 2013 and 2014; Yahoo disclosed them this past September and December.

The lower sales price will cost Yahoo shareholders roughly 37 cents per share. But they may also be responsible for substantial legal costs.

What's left of Yahoo after the deal closes — an entity that will be called Altaba Inc. and have stakes in Chinese e-commerce giant Alibaba Group and Yahoo Japan — will be responsible for liabilities stemming from shareholder lawsuits and from the Securities and Exchange Commission probe of Yahoo. Verizon and Altaba will split costs from all other hack-related lawsuits and government investigations.

This agreement "provides protections for both sides" and should help the deal close by the end of June, Marni Walden, Verizon's head of product innovation and new businesses, said in a statement. Yahoo shareholders have to approve it.

Avoiding an even larger reduction in the deal value represents a small victory for Yahoo CEO Marissa Mayer, who had already been under fire on Wall Street for her inability to turn around the company and then for the humiliating security lapses that came under her watch.

Verizon's willingness to accept some of the lingering risks from Yahoo's security breaches underscores the wireless carrier's desire to become a bigger player in the digital advertising market. Google and Facebook currently dominate, but Verizon believes there's room to grow.

Because most people already have smartphones, wireless carriers such as Verizon have turned to price cuts and promotions to lure customers from each other. Under pressure, Verizon even restored unlimited data plans this month, robbing it of revenue from monster-size data plans.

Instead, Verizon is trying to make money off the hours people spend gazing at their phones. It bought AOL for $4.4 billion US in 2015 for its advertising technology. Verizon now wants to bolster that with Yahoo's technology, as well as its many users and popular websites devoted to sports, finance, entertainment and news.

Yahoo shares rose 14 cents to $45.24 US in morning trading Tuesday; Verizon stock added 22 cents to $49.41 US.