Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Batch 3 Web Dev 2020
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bhavani Shankar
Batch 3 Web Dev 2020
Commits
95e1dd07
Commit
95e1dd07
authored
4 years ago
by
Sibidharan
Browse files
Options
Downloads
Patches
Plain Diff
Secure Code Seperation
parent
ffd35987
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
stars
+0
-0
0 additions, 0 deletions
stars
stars.c
+27
-0
27 additions, 0 deletions
stars.c
stars.php
+31
-0
31 additions, 0 deletions
stars.php
with
58 additions
and
0 deletions
stars
0 → 100755
+
0
−
0
View file @
95e1dd07
File added
This diff is collapsed.
Click to expand it.
stars.c
0 → 100644
+
27
−
0
View file @
95e1dd07
#include
<stdio.h>
#include
<stdlib.h>
/*
Input: ./a.out 5
Output:
*
**
***
****
*****
*/
int
main
(
int
argc
,
char
*
argv
[]){
int
count
=
atoi
(
argv
[
1
]);
for
(
int
i
=
0
;
i
<=
count
;
i
++
){
for
(
int
j
=
0
;
j
<
i
;
j
++
){
printf
(
"*"
);
}
printf
(
"
\n
"
);
}
printf
(
"
\n
"
);
return
0
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
stars.php
0 → 100644
+
31
−
0
View file @
95e1dd07
<pre>
<?
//secure code
// if(isset($_GET['count'])){
// $count = $_GET['count'];
// $re = "/^[0-9]+$/";
// $matches = preg_match($re, $count);
// print_r($matches);
// if($matches){
// $cmd = "./stars $count";
// print($cmd);
// system($cmd);
// } else {
// print("Don't try to hack me :D");
// }
// } else {
// echo "Something is wrong";
// }
//insecure code
if
(
isset
(
$_GET
[
'count'
])){
$count
=
$_GET
[
'count'
];
$re
=
"/^[0-9]+$/"
;
$cmd
=
"./stars
$count
"
;
print
(
$cmd
);
system
(
$cmd
);
}
else
{
echo
"Something is wrong"
;
}
?>
</pre>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment