Adust buffers to fix potential buffer overruns
This commit is contained in:
@@ -1050,7 +1050,7 @@ public:
|
||||
return "undef";
|
||||
}
|
||||
|
||||
char buffer[1024];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%.2fmm", val * 25.4 / 1000);
|
||||
return buffer;
|
||||
}
|
||||
@@ -1062,7 +1062,7 @@ class CAExposureTimeInterpreter : public Interpreter
|
||||
public:
|
||||
virtual std::string toString (Tag* t)
|
||||
{
|
||||
char buffer[1024];
|
||||
char buffer[32];
|
||||
double d = pow (2, - t->toInt() / 32.0);
|
||||
sprintf (buffer, "%.3f", d);
|
||||
return buffer;
|
||||
@@ -1074,7 +1074,7 @@ class CAEVInterpreter : public Interpreter
|
||||
{
|
||||
virtual std::string toString (Tag* t)
|
||||
{
|
||||
char buffer[1024];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%.1f", t->toDouble() / 32.0 );
|
||||
return buffer;
|
||||
}
|
||||
@@ -1281,7 +1281,7 @@ class CAFocusDistanceInterpreter : public Interpreter
|
||||
public:
|
||||
virtual std::string toString (Tag* t)
|
||||
{
|
||||
char buffer[1024];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%.2f", t->toDouble() / 100 );
|
||||
return buffer;
|
||||
}
|
||||
@@ -1293,7 +1293,7 @@ class CAMeasuredEVInterpreter : public Interpreter
|
||||
public:
|
||||
virtual std::string toString (Tag* t)
|
||||
{
|
||||
char buffer[1024];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%.1f", t->toDouble() / 8 - 6 );
|
||||
return buffer;
|
||||
}
|
||||
|
@@ -1320,7 +1320,7 @@ public:
|
||||
a = t->toInt(0, SBYTE) / 6; // int8u[2]
|
||||
}
|
||||
|
||||
char buffer[10];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%d", a );
|
||||
return buffer;
|
||||
}
|
||||
@@ -1348,7 +1348,7 @@ public:
|
||||
double a = double(t->toInt(0, LONG));
|
||||
|
||||
if(a > 1.) {
|
||||
char buffer[10];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%.2f", a / 100. );
|
||||
return buffer;
|
||||
} else {
|
||||
@@ -1378,7 +1378,7 @@ public:
|
||||
float b = float(10 * int(a >> 2)) * pow(4.f, float(int(a & 0x03) - 2));
|
||||
|
||||
if(b > 1.f) {
|
||||
char buffer[10];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%.2f", b );
|
||||
return buffer;
|
||||
} else {
|
||||
@@ -1680,7 +1680,7 @@ public:
|
||||
PAExternalFlashGNInterpreter() {}
|
||||
virtual std::string toString (Tag* t)
|
||||
{
|
||||
char buffer[1024];
|
||||
char buffer[32];
|
||||
int b = t->toInt(0, BYTE) & 0x1F;
|
||||
sprintf (buffer, "%.0f", pow(2., b / 16. + 4) );
|
||||
return buffer;
|
||||
|
@@ -1955,7 +1955,7 @@ public:
|
||||
double a = t->toDouble();
|
||||
|
||||
if(a > 0) {
|
||||
char buffer[10];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%.4f", a);
|
||||
return buffer;
|
||||
} else {
|
||||
@@ -2015,7 +2015,7 @@ public:
|
||||
double a = double(t->toDouble());
|
||||
|
||||
if(a) {
|
||||
char buffer[10];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%.1f", a / 100. );
|
||||
return buffer;
|
||||
} else {
|
||||
@@ -2075,7 +2075,7 @@ public:
|
||||
int a = t->toInt();
|
||||
|
||||
if(a) {
|
||||
char buffer[10];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%d", a );
|
||||
return buffer;
|
||||
} else {
|
||||
@@ -2114,7 +2114,7 @@ public:
|
||||
virtual std::string toString (Tag* t)
|
||||
{
|
||||
double a = t->toDouble();
|
||||
char buffer[10];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%.2f", a );
|
||||
return buffer;
|
||||
}
|
||||
@@ -2134,7 +2134,7 @@ public:
|
||||
SAAFMicroAdjValueInterpreter() {}
|
||||
virtual std::string toString (Tag* t)
|
||||
{
|
||||
char buffer[10];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%d", t->getValue()[0] - 20);
|
||||
return buffer;
|
||||
}
|
||||
@@ -2173,7 +2173,7 @@ public:
|
||||
SAAFMicroAdjRegisteredLensesInterpreter() {}
|
||||
virtual std::string toString (Tag* t)
|
||||
{
|
||||
char buffer[10];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%d", t->getValue()[0] & 0x7f);
|
||||
return buffer;
|
||||
}
|
||||
@@ -2229,7 +2229,7 @@ public:
|
||||
SAColorTemperatureSettingInterpreter () {}
|
||||
virtual std::string toString (Tag* t)
|
||||
{
|
||||
char buffer[10];
|
||||
char buffer[32];
|
||||
sprintf (buffer, "%d", t->toInt());
|
||||
return buffer;
|
||||
}
|
||||
|
@@ -386,7 +386,7 @@ public:
|
||||
ShutterSpeedInterpreter () {}
|
||||
virtual std::string toString (Tag* t)
|
||||
{
|
||||
char buffer[1024];
|
||||
char buffer[32];
|
||||
double d = pow (2.0, -t->toDouble());
|
||||
|
||||
if (d > 0.0 && d < 0.9) {
|
||||
@@ -406,7 +406,7 @@ public:
|
||||
ExposureTimeInterpreter () {}
|
||||
virtual std::string toString (Tag* t)
|
||||
{
|
||||
char buffer[1024];
|
||||
char buffer[32];
|
||||
double d = t->toDouble();
|
||||
|
||||
if (d > 0.0 && d < 0.9) {
|
||||
|
Reference in New Issue
Block a user