Thursday, 15 August 2013

asp.net - Fortify Scan Correction -



asp.net - Fortify Scan Correction -

i new hp fortify, , need help of identified scan errors.  line marked stars rated critical, , don't know different way it:

list<string> listnames = getusers(); if (listnames.count > 0) { foreach (var name in listnames) ***lblookup.items.add(name); //lblookup asp:listbox }

in code

if(listnames.count > 0)

checks if list contains elements or empty.

but should check every element if null or empty string before adding listbox. becuase additional check each element may solve problem. seek :

if (listnames.count > 0) { foreach (var name in listnames) { if(!string.isnullorempty(name)) // making sure null items not added listbox lblookup.items.add(name); } }

another thing can checking asp:listbox object not null before adding elements items.

asp.net

No comments:

Post a Comment