The m-z relation for type~Ia supernovae is one of the key pieces of evidence supporting the cosmological `concordance model' with lambda_0 approximately 0.7 and Omega_0 approximately 0.3. However, it is well known that the m-z relation depends not only on lambda_0 and Omega_0 (with H_0 as a scale factor) but also on the density of matter along the line of sight, which is not necessarily the same as the large-scale density. I investigate to what extent the measurement of lambda_0 and Omega_0 depends on this density when it is characterized by the parameter eta (0 <= eta <= 1), which describes the ratio of density along the line of sight to the overall density. I also discuss what constraints can be placed on eta, both with and without constraints on lambda_0 and Omega_0 in addition to those from the m-z relation for type Ia supernovae.