@s3my0n; Try to avoid returning improperly allocated pointers. It's far too easy for a pointer to be invalidated somewhere else in the code, often somehow due to variable scope, and a segfault can occur when information is read from or written to that invalid pointer. If you must return a pointer, malloc()(or calloc()) it and insist that it be free()'d. Much of the time it's best to accept as an argument a pointer to a section of memory where the data should be written so that the variable scope control is left to the caller(and thus left to the responsibility of the function user, not the function writer).
@Kulverstukas; You may consider returning an 'int' to tell the function user whether there was or wasn't an error. You could also return a positive value(0 included) for the character index(0..n-1) at which the last FS(field separator; '/' or '\', in this case) was found and a negative value if it was not found. On the other hand, you could set it to unsigned int and return the character number(1..n) at which the last FS was found and 0 if it was not found.