summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimeon Bird <bladud@gmail.com>2012-08-18 20:00:54 (GMT)
committerSimeon Bird <bladud@gmail.com>2012-08-21 03:59:13 (GMT)
commit5609c4cdd8c7d938a9b3e99285b1044eea2fcf04 (patch)
tree78d858a3c17f42fc6d9c050faa93b165292f25b1
parent904f3ec79c605a170d0a459fb1a4759b63af3798 (diff)
Replace qstrlen with qstrnlen.
When we get an inotify event, we use qstrlen on event->name to get the event name. If event->name is not null terminated, bad things will happen. Use qstrnlen to avoid them.
-rw-r--r--services/filewatch/kinotify.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/filewatch/kinotify.cpp b/services/filewatch/kinotify.cpp
index 509abff..454a0c5 100644
--- a/services/filewatch/kinotify.cpp
+++ b/services/filewatch/kinotify.cpp
@@ -287,7 +287,7 @@ void KInotify::slotEvent( int socket )
}
else {
// we cannot use event->len here since it contains the size of the buffer and not the length of the string
- const QByteArray eventName = QByteArray::fromRawData( event->name, qstrlen(event->name) );
+ const QByteArray eventName = QByteArray::fromRawData( event->name, qstrnlen(event->name,event->len) );
const QByteArray hashedPath = d->watchPathHash.value( event->wd );
path = concatPath( hashedPath, eventName );
}