This is the DiffuseLight() function, from UnityCG.cginc. You can find this file in your Unity.app bundle under CGIncludes, or some equivalent in the Windows Unity install folder.
Your replacement is similar, but incomplete. It’s missing the light colour and the doubling. If you were using a directional light, the lack of normalization might have caused trouble.
You must normalize your vectors before doing a dot product if you wish to retrieve the arc cosine value required for lambertian (and other) diffuse calculations.
In most cases, the normal is already very close to unit length by the time you get to the fragment shader. The light direction is already normalized in the case of directional lights, and gets normalized in DiffuseLight() when it is not a directional light.