A safe lane-keeping controller is designed using a control barrier function (CBF) which ensures that if the vehicle starts between the lane boundaries then it does not leave the lane. The safety filter is applied on the top of a nominal path-following controller of the kinematic single-track model in order to modify the control input when the vehicle gets close to the boundary of the safe set in state space. Numerical simulations and phase portraits are used to demonstrate the performance of the proposed safety-critical controller.