[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/libs/libkexif
From:       Dirk Mueller <mueller () kde ! org>
Date:       2006-02-16 13:18:36
Message-ID: 1140095916.691815.28611.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 510120 by mueller:

fix buffer overflows


 M  +12 -12    kexifdata.cpp  
 M  +4 -4      kexifentry.cpp  


--- trunk/extragear/libs/libkexif/kexifdata.cpp #510119:510120
@@ -222,11 +222,11 @@
       if (entry)
       {
 #ifdef HAVE_EXIF06
-          char val[1024];
-          exif_entry_get_value(entry, val, 1023);
+          QCString cstr(1024);
+          exif_entry_get_value(entry, cstr.data(), cstr.size()-1);
           // just in case we don't get a null-terminated string
-          val[1024] = '\0'; 
-          QString str((const char*)&val);
+          cstr[cstr.size()-1] = '\0'; 
+          QString str = QString::fromLatin1(cstr.data());
 #else
           QString str(exif_entry_get_value(entry));
 #endif
@@ -246,11 +246,11 @@
       if (entry)
       {
 #ifdef HAVE_EXIF06
-          char val[1024];
-          exif_entry_get_value(entry, val, 1023);
+          QCString cstr(1024);
+          exif_entry_get_value(entry, cstr.data(), cstr.size()-1);
           // just in case we don't get a null-terminated string
-          val[1024] = '\0'; 
-          QString str((const char*)&val);
+          cstr[cstr.size()-1] = '\0'; 
+          QString str = QString::fromLatin1(cstr.data());
 #else
           QString str(exif_entry_get_value(entry));
 #endif
@@ -265,11 +265,11 @@
       if (entry)
       {
 #ifdef HAVE_EXIF06
-          char val[1024];
-          exif_entry_get_value(entry, val, 1023);
+          QCString cstr(1024);
+          exif_entry_get_value(entry, cstr.data(), cstr.size()-1);
           // just in case we don't get a null-terminated string
-          val[1024] = '\0'; 
-          QString str((const char*)&val);
+          cstr[cstr.size()-1] = '\0'; 
+          QString str = QString::fromLatin1(cstr.data());
 #else
           QString str(exif_entry_get_value(entry));
 #endif
--- trunk/extragear/libs/libkexif/kexifentry.cpp #510119:510120
@@ -100,11 +100,11 @@
     mDescription = QString::fromUtf8(exif_tag_get_description(mExifEntry->tag));
 
 #ifdef HAVE_EXIF06
-    char val[1024];
-    exif_entry_get_value(mExifEntry, val, 1023);
+    QCString cstr(1024);
+    exif_entry_get_value(mExifEntry, cstr.data(), cstr.size()-1);
     // just in case we don't get a null-terminated string
-    val[1024] = '\0'; 
-    mValue = QString::fromUtf8((const char*)&val);
+    cstr[cstr.size()-1] = '\0';
+    QString str = QString::fromLatin1(cstr.data());
 #else
     mValue = QString::fromUtf8(exif_entry_get_value(mExifEntry));
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic