As pointed out in other answers, NULL not valid for going to sscanf as an extra argument.
http://www.cplusplus.com/reference/cstdio/sscanf talks about additional arguments:
Depending on the format string, the function may expect a sequence of additional arguments, each of which contains a pointer to the allocated storage, where the interpretation of the extracted characters is stored with the corresponding type .
For the %s qualifier, these extracted characters are ::
Any number of characters without spaces, stopping when the first character is found. A trailing null character is automatically added at the end of a stored sequence.
So, when “characters with no spaces” and “null termination” are stored, segfault will exist. This is exactly what Visual Studio will give (you can verify that this fails http://webcompiler.cloudapp.net/ ):

Now, for non-Visual Visual Studio compilers, the libc extraction code for the %s specifier: https://github.com/ffainelli/uClibc/blob/master/libc/stdio/_scanf.c#L1376 has a leading comment: /* We might have to handle the allocation ourselves */ this is because:
The GNU C library supports the dynamic allocation conversion specifier (as a non-standard extension) using the a symbol. This feature, apparently, is present, at least, as glibc 2.0.
Starting with version 2.7, glibc also provides the m modifier for the same purpose as the a modifier.
[ Source ]
So, since libc extracts into the buffer built internally before sscanf and then checks that the buffer parameter has no flags set before it is assigned, it will never write characters to the NULL buffer parameter.
I can’t stress that this is non-standard and cannot be guaranteed even between minor library updates. A much better way to do this is to use a sub-qualifier * , which:
Indicates that data should be read from the stream but ignored (i.e. it is not stored in the location specified by the argument).
[ Source ]
This can be done, for example, as follows:
s == NULL ? sscanf("Privjet mir!", "%*s") : sscanf("Privjet mir!", "%s", s);
Obviously, the true branch of the triple is non-op, but I included it with the expectation that other data should be read from the string.