Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
90e53f0c
Commit
90e53f0c
authored
Nov 03, 2003
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed potentially uninitialized memory bug in compatlib.
parent
0637d52d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
33 deletions
+47
-33
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+4
-0
src/interfaces/ecpg/compatlib/informix.c
src/interfaces/ecpg/compatlib/informix.c
+43
-33
No files found.
src/interfaces/ecpg/ChangeLog
View file @
90e53f0c
...
...
@@ -1705,6 +1705,10 @@ Thu Oct 30 11:12:37 CET 2003
Fri Oct 31 15:09:22 CET 2003
- If EOF is found inside a string/comment/etc. stop parsing.
Mon Nov 3 15:43:19 CET 2003
- Fixed a potentially uncleared allocation in compatlib.
- Set ecpg version to 3.0.0
- Set ecpg library to 4.0.0
- Set pgtypes library to 1.0.0
...
...
src/interfaces/ecpg/compatlib/informix.c
View file @
90e53f0c
...
...
@@ -3,6 +3,7 @@
#include <errno.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#include <ecpgtype.h>
#include <compatlib.h>
...
...
@@ -11,7 +12,7 @@
#include <pgtypes_numeric.h>
#include <sqltypes.h>
char
*
ECPGalloc
(
long
,
int
);
char
*
ECPGalloc
(
long
,
int
);
static
int
deccall2
(
decimal
*
arg1
,
decimal
*
arg2
,
int
(
*
ptr
)
(
numeric
*
,
numeric
*
))
...
...
@@ -659,41 +660,50 @@ static struct
}
value
;
/**
* initialize the struct, wich holds the different forms
* initialize the struct, w
h
ich holds the different forms
* of the long value
*/
static
void
initValue
(
long
lng_val
)
{
int
i
,
div
,
dig
;
char
tmp
[
2
]
=
" "
;
/* set some obvious things */
value
.
val
=
lng_val
>=
0
?
lng_val
:
lng_val
*
(
-
1
);
value
.
sign
=
lng_val
>=
0
?
'+'
:
'-'
;
value
.
maxdigits
=
log10
(
2
)
*
(
8
*
sizeof
(
long
)
-
1
);
/* determine the number of digits */
for
(
i
=
0
;
i
<=
value
.
maxdigits
;
i
++
)
{
if
((
int
)
(
value
.
val
/
pow
(
10
,
i
))
!=
0
)
value
.
digits
=
i
+
1
;
}
value
.
remaining
=
value
.
digits
;
/* convert the long to string */
value
.
val_string
=
(
char
*
)
malloc
(
value
.
digits
+
1
);
for
(
i
=
value
.
digits
;
i
>
0
;
i
--
)
{
div
=
pow
(
10
,
i
);
dig
=
(
value
.
val
%
div
)
/
(
div
/
10
);
tmp
[
0
]
=
(
char
)
(
dig
+
48
);
strcat
(
value
.
val_string
,
tmp
);
}
/* safety-net */
value
.
val_string
[
value
.
digits
]
=
'\0'
;
initValue
(
long
lng_val
)
{
int
i
,
j
;
long
l
,
dig
;
/* set some obvious things */
value
.
val
=
lng_val
>=
0
?
lng_val
:
lng_val
*
(
-
1
);
value
.
sign
=
lng_val
>=
0
?
'+'
:
'-'
;
value
.
maxdigits
=
log10
(
2
)
*
(
8
*
sizeof
(
long
)
-
1
);
/* determine the number of digits */
i
=
0
;
l
=
1
;
do
{
i
++
;
l
*=
10
;
}
while
((
l
-
1
)
<
value
.
val
&&
l
<=
LONG_MAX
/
10
);
if
(
l
<=
LONG_MAX
/
10
)
{
value
.
digits
=
i
;
l
/=
10
;
}
else
value
.
digits
=
i
+
1
;
value
.
remaining
=
value
.
digits
;
/* convert the long to string */
value
.
val_string
=
(
char
*
)
malloc
(
value
.
digits
+
1
);
dig
=
value
.
val
;
for
(
i
=
value
.
digits
,
j
=
0
;
i
>
0
;
i
--
,
j
++
)
{
value
.
val_string
[
j
]
=
dig
/
l
+
'0'
;
dig
=
dig
%
l
;
l
/=
10
;
}
value
.
val_string
[
value
.
digits
]
=
'\0'
;
}
/* return the position oft the right-most dot in some string */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment