473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

how to store untainted string in perl

8
Hi friends,

I want to take a description (atleast 50 characters) from the html page using cgi->param and store it into a string variable in perl and pass this string variable to a query. for this i wrote the following code

my $desc = $cgi->param('comment')

then the error occured

Software error:
Insecure dependency in exec while running with -T switch at /var/www/html

So i changed the above line to

my $desc = $cgi->param('comment') =~ m/(.+)/ ? $1 :'';

is it correct???

Now error is not comming but the query insert function is not working..

But when i'm assigning the $desc with some string directly..then the query insert function is working properly..

Can anyone plz help me to solve this problem..

Thanks in advance
Kokul
Jul 20 '07 #1
3 1585
KevinADC
4,059 Expert 2GB
it looks like it should work, but try like this and see if it helps:

Expand|Select|Wrap|Line Numbers
  1. my $desc = '';
  2. if ($cgi->param('comment') =~ m/(.+)/) {
  3.    $desc = $1;
  4. }
but really the regexp is not making $desc secure in any meaningful way because you are just accepting whatever value it has. But maybe you're just trying to get the syntax correct for right now.
Jul 20 '07 #2
kokul
8
it looks like it should work, but try like this and see if it helps:

Expand|Select|Wrap|Line Numbers
  1. my $desc = '';
  2. if ($cgi->param('comment') =~ m/(.+)/) {
  3.    $desc = $1;
  4. }
but really the regexp is not making $desc secure in any meaningful way because you are just accepting whatever value it has. But maybe you're just trying to get the syntax correct for right now.
Dear Kevin,

The above code is working... But it takes only the first line from the text box. I want to take all the lines. How can i do it??
Dec 14 '07 #3
KevinADC
4,059 Expert 2GB
add the "s" modifier to the end of the regexp:

Expand|Select|Wrap|Line Numbers
  1. if ($cgi->param('comment') =~ m/(.+)/s) {
Dec 14 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sammy | last post by:
Hi, I'm working on my first real-world C++ project where all hard-coded messages (lots of them) are "#define" in a header file. These strings are used to be encapsulated into event that send to...
3
by: micmic | last post by:
Deear all experts, In the MySQL, we can use escape character '\' to save the STRING WITH single quote into database (eg. we would like to insert into table "tbl_ABC"with the string ab'c, we...
5
by: Simon Harvey | last post by:
Hi everyone, As I understand it, storing an applications SQL Server connection string in the web.config file is a security risk. I'm wondering then, what the simplest solution is to this...
6
by: Perin | last post by:
Hi, I am using SQL Server as a Database in my ASP.NET application. Can anyone tell me, how to store my connection string in web.config file and access it from my application. It is very urgent...
9
by: vijetha | last post by:
Hi, I have been trying to store a string into a vector but I am not able to figure out how to do it. I am able to use vectors for storing integers but not able to use them fro strings. I want to...
8
by: Gary | last post by:
When you declare an array of chars and store a string in it, where is the position of the null character \0? And what happens to the unused memory locations? #include <stdio.h> int main(void)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.