You are legal for working 240 days after the expiration date.
"240-day rule”
When an extension of H-1B status has been filed with the USCIS in a timely manner, and is pending adjudication, departments may extend the individual’s employment authorization on payroll for 240 days beyond the expiration date of the individual’s current H-1B status, as provided for in immigration regulations. This provision is known as the “240-day rule”. The petition has been filed in a timely manner when it has been submitted and received by the USCIS before the individual’s H-1B status expires.