Tag: security
Questions Related to security
unsigned char j,k; j=getchar(); k=getchar(); unsigned char result = j + k; What vulnerability is present in this code:
What is the vulnerability ?
int main (int argc, char *argv[]) {
char k[3];
int i=0,j=1;
char buffer[50];
strncpy(buffer, argv[1], sizeof(buffer) - 1);
buffer[49]='/0';
unsigned char ch='a';
k[0]=1;
do{
i++;
k[i]=ch+i;
} while(i<3);
return 0;
}
Identify the Vulnerable Line # in the below code:
1 ...
2 public static Connection getConnection()
3 {
4 Connection con = null;
5 try
6 {
7 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
8 con = DriverManager.getConnection("jdbc:odbc:Lookup","admin","admin");
9
10 }catch (ClassNotFoundException e)
11 {
12 if(con!=null)
13 close(con);
14 log.debug(“Error Occurred:” + e);
15
16 } catch(SQLException ex)
17 {
18
19 if(con!=null)
20 close(con);
21 log.debug(“Error Occurred:” + ex);
22 }
23 return con;
24 }
25 ...