In the frame of Gauss–Bonnet gravity and in the limit of D→4, based on the fact that spherically symmetric solution derived using any of regularization schemes will be the same form as the original theory, we derive a new interior spherically symmetric solution assuming specific forms of the metric potentials that have two constants. Using the junction condition we determine these two constants. By using the data of the star EXO 1785-248, whose mass is M=1.3±0.2M⊙ and radius l=8.849±0.4 km, we calculate the numerical values of these constants, in terms of the dimensionful coupling parameter of the Gauss–Bonnet term, and eventually, we get real values for these constants. In this regard, we show that the components of the energy–momentum tensor have a finite value at the center of the star as well as a smaller value to the surface of the star. Moreover, we show that the equations of the state behave in a non-linear way due to the impact of the Gauss–Bonnet term. Using the Tolman–Oppenheimer–Volkoff equation, the adiabatic index, and stability in the static state we show that the model under consideration is always stable. Finally, the solution of this study is matched with observational data of other pulsars showing satisfactory results.