Skip to content

Commit

Permalink
A few fixes + security
Browse files Browse the repository at this point in the history
- Cleaned up a little bit
- Seciurity: MinGW build are now configured with stack protector, DEP
and ASLR
- Proxy: having a proxy set in Internet options is not a problem anymore
  • Loading branch information
EstevanTH committed Mar 11, 2018
1 parent 94d8d3c commit c608bc9
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 77 deletions.
2 changes: 1 addition & 1 deletion Qt_Projects/gpsd_javascript_relay/Application.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "Application.h"

QString const Application::s_version = "0.9.3";
QString const Application::s_version = "0.9.3a";
QString const Application::s_appTitle = "GPSD to JavaScript relay";
QSettings* Application::s_appSettings = 0;
Application* Application::s_instance = 0;
Expand Down
1 change: 1 addition & 0 deletions Qt_Projects/gpsd_javascript_relay/Bugs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Il manque un espace dans "Port actuel�:COM19"
4 changes: 4 additions & 0 deletions Qt_Projects/gpsd_javascript_relay/GpsdClient.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "GpsdClient.h"
#include <QNetworkProxy>

#include "compiler_options.h"

#define CAST_SOCKET( socket, socketNetwork, socketTcp, socketUdp, socketSerial ) \
Expand Down Expand Up @@ -352,6 +354,7 @@ void GpsdClient::connectToHost(GpsdHost const& host){
socketNetwork->setSocketOption( QAbstractSocket::ReceiveBufferSizeSocketOption, GPSD_RECEIVE_BUFFER );
socketNetwork->setSocketOption( QAbstractSocket::KeepAliveOption, 1 );
socketNetwork->setSocketOption( QAbstractSocket::LowDelayOption, 1 );
socketNetwork->setProxy( QNetworkProxy::NoProxy );
// Note: m_socket->bind() and m_socket->connectToHost() can both produce errors.
connect( socketNetwork, SIGNAL( error(QAbstractSocket::SocketError) ), this, SLOT( socketError(QAbstractSocket::SocketError) ) );
}
Expand Down Expand Up @@ -544,6 +547,7 @@ void GpsdClient::incomingData(){
m_expectedAnswers = 0;
m_lastAnswer = QDateTime::currentMSecsSinceEpoch();

if( !m_socket ) return; // because events are not synchronous
m_bufferIn.append( m_socket->readAll() );
while( m_bufferIn.size()>0 ){
// WARNING: This code has not been tested under unexpected incoming traffic type!
Expand Down
2 changes: 2 additions & 0 deletions Qt_Projects/gpsd_javascript_relay/HttpServer.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "HttpServer.h"
#include <QNetworkProxy>

/// Static stuff:
HttpServer* HttpServer::s_httpServer = 0;
Expand Down Expand Up @@ -67,6 +68,7 @@ void HttpServer::changeSetup(HttpServerSetup const& newSetup){
void HttpServer::startServer(){
if( !m_tcpServer ){
m_tcpServer = new QTcpServer( this );
m_tcpServer->setProxy( QNetworkProxy::NoProxy );
connect( m_tcpServer, SIGNAL( newConnection() ), this, SLOT( welcomeClient() ) );
m_requests = 0;
}
Expand Down
8 changes: 4 additions & 4 deletions Qt_Projects/gpsd_javascript_relay/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<item>
<widget class="QPushButton" name="m_btnStatus">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand All @@ -54,7 +54,7 @@
<item>
<widget class="QPushButton" name="m_btnSources">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand All @@ -71,7 +71,7 @@ Se&amp;rvers</string>
<item>
<widget class="QPushButton" name="m_btnTargets">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand All @@ -87,7 +87,7 @@ Se&amp;rvers</string>
<item>
<widget class="QPushButton" name="m_btnAbout">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand Down
18 changes: 17 additions & 1 deletion Qt_Projects/gpsd_javascript_relay/gpsd_javascript_relay.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ QT += core gui network serialport

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

# Sécurité
equals( QMAKE_LINK, g++ ){
QMAKE_CFLAGS_RELEASE += -fstack-protector-all
QMAKE_CXXFLAGS_RELEASE += -fstack-protector-all
QMAKE_LFLAGS_RELEASE += -Wl,--nxcompat -Wl,--dynamicbase,--export-all-symbols -fstack-protector-all
contains( QMAKE_QMAKE, 64 ){
QMAKE_LFLAGS_RELEASE += -Wl,--high-entropy-va
}
}
equals( QMAKE_LINK, link ){
QMAKE_LFLAGS_RELEASE += /NXCOMPAT /DYNAMICBASE
contains( QMAKE_QMAKE, 64 ){
QMAKE_LFLAGS_RELEASE += /HIGHENTROPYVA
}
}

TARGET = gpsd_javascript_relay
TEMPLATE = app

Expand Down Expand Up @@ -59,4 +75,4 @@ RC_ICONS = gpsd_javascript_relay_32.ico
RESOURCES += \
gpsd_javascript_relay.qrc

TRANSLATIONS = tp-znavigo-le-navigateur-web-des-zeros_fr.ts
TRANSLATIONS = gpsd_javascript_relay_fr.ts
140 changes: 70 additions & 70 deletions Qt_Projects/gpsd_javascript_relay/gpsd_javascript_relay.pro.user

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<RCC>
<qresource prefix="/">
<file>gpsd_javascript_relay_fr.qm</file>
<file>gpsd_javascript_relay_32.png</file>
<file>icon16_add.png</file>
<file>icon16_remove.png</file>
<file>gpsd_javascript_relay_fr.qm</file>
<file>icon32_ok.png</file>
</qresource>
</RCC>

0 comments on commit c608bc9

Please sign in to comment.