I've been struggling an immense amount in identifying Vulnerabilities and demonstrating on steps to prove that it is a v
Posted: Fri Apr 29, 2022 6:53 am
I've been struggling an immense amount in identifying
Vulnerabilities and demonstrating on steps to prove that it is a
vulnerability without using means of exploits.
Any help in directing me to what type of vulnerabilities can be
identified here and means of showing that it is a vulnerability
would be greatly appreciated!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char input[16];
char* openFile(char *filename, int select);
int readWord(char *argv);
int main (int argc, char **argv)
{
char *det="input1.txt";
char *output;
int select=1;
if (argc>1)
select=readWord(argv[1]);
output=openFile(det,select);
printf("%s\n",output);
}
int readWord(char *argv)
{
int word;
printf("Which number word do you want selected? ");
scanf("%d",&word);
printf("word is %d\n",word);
strcpy(input,argv);
return word;
}
char* openFile(char *filename, int select)
{
int x;
FILE *f0;
char *fileScan;
fileScan=malloc(16);
if ((f0=fopen(filename,"r"))==NULL)
{printf("Error\n");exit(0);}
for (x=0;x<(select+1);x++)
fscanf(f0,"%s",fileScan);
fclose(f0);
return fileScan;
}
Vulnerabilities and demonstrating on steps to prove that it is a
vulnerability without using means of exploits.
Any help in directing me to what type of vulnerabilities can be
identified here and means of showing that it is a vulnerability
would be greatly appreciated!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char input[16];
char* openFile(char *filename, int select);
int readWord(char *argv);
int main (int argc, char **argv)
{
char *det="input1.txt";
char *output;
int select=1;
if (argc>1)
select=readWord(argv[1]);
output=openFile(det,select);
printf("%s\n",output);
}
int readWord(char *argv)
{
int word;
printf("Which number word do you want selected? ");
scanf("%d",&word);
printf("word is %d\n",word);
strcpy(input,argv);
return word;
}
char* openFile(char *filename, int select)
{
int x;
FILE *f0;
char *fileScan;
fileScan=malloc(16);
if ((f0=fopen(filename,"r"))==NULL)
{printf("Error\n");exit(0);}
for (x=0;x<(select+1);x++)
fscanf(f0,"%s",fileScan);
fclose(f0);
return fileScan;
}