D12744: Add null pointer check when creating SocketAddress

2018-05-07 Thread Chinmoy Ranjan Pradhan
chinmoyr created this revision.
chinmoyr added reviewers: dfaure, ossi.
Restricted Application added a project: Frameworks.
Restricted Application added a subscriber: Frameworks.
chinmoyr requested review of this revision.

REVISION SUMMARY
  If for some reason SocketAddress:make_address() fails to create a proper 
sockaddr_un structure
  then SocketAddress::address() will return a null pointer. In such case, to 
prevent application
  crash, check for null pointer prior to any socket operation.
  
  Based on D10411 

REPOSITORY
  R241 KIO

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D12744

AFFECTED FILES
  src/ioslaves/file/fdreceiver.cpp
  src/ioslaves/file/kauth/fdsender.cpp

To: chinmoyr, dfaure, ossi
Cc: #frameworks, michaelh, ngraham, bruns


D12744: Add null pointer check when creating SocketAddress

2018-05-07 Thread Chinmoy Ranjan Pradhan
chinmoyr added a dependency: D10411: Create socket file in user's runtime 
directory.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D12744

To: chinmoyr, dfaure, ossi
Cc: #frameworks, michaelh, ngraham, bruns


D12744: Add null pointer check when creating SocketAddress

2018-05-07 Thread Chinmoy Ranjan Pradhan
chinmoyr added a dependent revision: D12745: Unify API for file descriptor 
sharing.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D12744

To: chinmoyr, dfaure, ossi
Cc: #frameworks, michaelh, ngraham, bruns


D12744: Add null pointer check when creating SocketAddress

2018-05-08 Thread David Faure
dfaure added inline comments.

INLINE COMMENTS

> fdreceiver.cpp:36
> +if (!addr.address()) {
> +std::cerr << "Invalid socket address" << std::endl;
> +return;

print out `m_path.toLocal8Bit()` here?

> fdsender.cpp:31
> +if (!addr.address()) {
> +std::cerr << "Invalid socket address" << std::endl;
> +return;

print out `path` here?

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D12744

To: chinmoyr, dfaure, ossi
Cc: #frameworks, michaelh, ngraham, bruns


D12744: Add null pointer check when creating SocketAddress

2018-05-08 Thread Chinmoy Ranjan Pradhan
chinmoyr updated this revision to Diff 33820.
chinmoyr added a comment.


  Print the invalid socket path in case of an error.

REPOSITORY
  R241 KIO

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D12744?vs=33769&id=33820

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D12744

AFFECTED FILES
  src/ioslaves/file/fdreceiver.cpp
  src/ioslaves/file/kauth/fdsender.cpp

To: chinmoyr, dfaure, ossi
Cc: #frameworks, michaelh, ngraham, bruns


D12744: Add null pointer check when creating SocketAddress

2018-05-08 Thread David Faure
dfaure added inline comments.

INLINE COMMENTS

> dfaure wrote in fdreceiver.cpp:36
> print out `m_path.toLocal8Bit()` here?

Possibly nitpicking, but toStdString converts to utf8 while toLocal8Bit() is 
what's used for SocketAddress and what's recommended for terminal output as 
well. If toLocal8Bit() doesn't compile, then you need 
m_path.toLocal8Bit().constData(). Or the short version for a cout/cerr 
statement:

  << qPrintable(m_path) << std::endl;

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D12744

To: chinmoyr, dfaure, ossi
Cc: #frameworks, michaelh, ngraham, bruns


D12744: Add null pointer check when creating SocketAddress

2018-05-08 Thread Chinmoy Ranjan Pradhan
chinmoyr updated this revision to Diff 33831.
chinmoyr added a comment.


  Used qPrintable()

REPOSITORY
  R241 KIO

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D12744?vs=33820&id=33831

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D12744

AFFECTED FILES
  src/ioslaves/file/fdreceiver.cpp
  src/ioslaves/file/kauth/fdsender.cpp

To: chinmoyr, dfaure, ossi
Cc: #frameworks, michaelh, ngraham, bruns


D12744: Add null pointer check when creating SocketAddress

2018-05-09 Thread David Faure
dfaure accepted this revision.
This revision is now accepted and ready to land.
Restricted Application edited subscribers, added: kde-frameworks-devel; 
removed: Frameworks.

REPOSITORY
  R241 KIO

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D12744

To: chinmoyr, dfaure, ossi
Cc: kde-frameworks-devel, michaelh, ngraham, bruns, #frameworks


D12744: Add null pointer check when creating SocketAddress

2018-05-27 Thread Oswald Buddenhagen
ossi requested changes to this revision.
ossi added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> fdreceiver.cpp:34
>  {
> +const SocketAddress addr(m_path.toLocal8Bit().constData());
> +if (!addr.address()) {

it would be more elegant to use m_path.toLocal8Bit().toStdString() here.

> fdsender.cpp:29
>  {
> +const SocketAddress addr(path.c_str());
> +if (!addr.address()) {

you're changing the type you're using for the call here. that's a good change, 
but logically not part of this patch.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D12744

To: chinmoyr, dfaure, ossi
Cc: kde-frameworks-devel, michaelh, ngraham, bruns


D12744: Add null pointer check when creating SocketAddress

2018-05-27 Thread Chinmoy Ranjan Pradhan
chinmoyr updated this revision to Diff 34961.
chinmoyr marked 2 inline comments as done.
chinmoyr added a comment.


  fixed the issues mentioned

REPOSITORY
  R241 KIO

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D12744?vs=33831&id=34961

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D12744

AFFECTED FILES
  src/ioslaves/file/fdreceiver.cpp
  src/ioslaves/file/kauth/fdsender.cpp

To: chinmoyr, dfaure, ossi
Cc: kde-frameworks-devel, michaelh, ngraham, bruns


D12744: Add null pointer check when creating SocketAddress

2018-05-27 Thread Oswald Buddenhagen
ossi accepted this revision.
This revision is now accepted and ready to land.

REPOSITORY
  R241 KIO

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D12744

To: chinmoyr, dfaure, ossi
Cc: kde-frameworks-devel, michaelh, ngraham, bruns


D12744: Add null pointer check when creating SocketAddress

2018-06-01 Thread Chinmoy Ranjan Pradhan
This revision was automatically updated to reflect the committed changes.
Closed by commit R241:bf7bfe9353c5: Add null pointer check when creating 
SocketAddress (authored by chinmoyr).

REPOSITORY
  R241 KIO

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D12744?vs=34961&id=35323

REVISION DETAIL
  https://phabricator.kde.org/D12744

AFFECTED FILES
  src/ioslaves/file/fdreceiver.cpp
  src/ioslaves/file/kauth/fdsender.cpp

To: chinmoyr, dfaure, ossi
Cc: kde-frameworks-devel, michaelh, ngraham, bruns